iodrivers_base
Timeout.hpp
Go to the documentation of this file.
1 #ifndef IODRIVERS_BASE_TIMEOUT_HPP
2 #define IODRIVERS_BASE_TIMEOUT_HPP
3 
4 #include <sys/time.h>
5 
6 namespace iodrivers_base {
7 
10 class Timeout {
11 private:
12  unsigned int timeout;
13  timeval start_time;
14 
15 public:
20  Timeout(unsigned int timeout = 0);
21 
25  void restart();
26 
32  bool elapsed() const;
33 
40  bool elapsed(unsigned int timeout) const;
41 
47  unsigned int timeLeft() const;
48 
55  unsigned int timeLeft(unsigned int timeout) const;
56 };
57 
58 }
59 
60 #endif
61 
void restart()
Definition: Timeout.cpp:10
Definition: Timeout.hpp:10
bool elapsed() const
Definition: Timeout.cpp:14
Definition: Bus.hpp:9
Timeout(unsigned int timeout=0)
Definition: Timeout.cpp:5
unsigned int timeLeft() const
Definition: Timeout.cpp:30