18 # include <sys/select.h> 50 const std::string& name_);
113 trace(
"Timer::Timer");
119 const TimeVal& delta_,
const std::string& name_)
122 trace(
"Timer::Timer(EH*, TV&)");
131 trace(
"Timer::Timer(Timer&)");
138 trace(
"Timer::~Timer");
179 DL((
REACT,
"Timer %s (EH=%s) expires at %s (delta=%s)\n",
193 return (*t1_ < *t2_);
TimerCompare class compares two Timers base on their expiration timestamp.
void set_id(const std::string &id_)
Set Timer ID.
#define trace(s)
trace() is used to trace function call chain in C++ program.
bool operator==(const Timer &t_) const
Equal by time.
const TimeVal & getExpirationTime() const
Get Expiration Time.
std::string get_id() const
Retrieve Timer ID.
TimeVal m_delta
Absolute value used when Reactor needs to reschedule the timer.
Class TimeVal is a wrapper around UNIX timeval structure.
~Timer()
Destructor: do-nothing.
EventHandler * m_eh
Pointer to EventHandler.
std::string m_id
Timer's ID.
string fmtString(const char *fmt_=NULL) const
Format timeval structure into readable format.
TimeVal m_timer
When the timer should be triggered.
Timer()
Default constructor.
Timer & operator=(const Timer &t_)
Assignment operator.
#define DL(X)
A macro for writing debug message to the Logger.
EventHandler * getHandler() const
Get EventHandler pointer.
std::string get_id() const
Retrieve EventHandler ID.
Class Reactor/PrioriyQueue messages.
const TimeVal & getDeltaTime() const
Get Delta time.
bool operator<(const Timer &t_) const
Less-that by time.
An abstract interface for handling I/O events, timers, and such.
void dump(void)
Dump contents to logfile.
void rescheduleExpirationTime()
Reschedule expiration time with Delta value.
static TimeVal gettimeofday()
Shields off underlying OS differences in getting current time.
string fmt_mm_ss_mls() const
Format timeval structure in readable format MM:SS.MLS.