#include <Timer.h>
Collaboration diagram for ASSA::Timer:
Public Member Functions | |
Timer () | |
Default constructor. | |
Timer (const EventHandler *eh_, const TimeVal &tm_, const TimeVal &delta_, const std::string &name_) | |
Constructor used by the TimerQueue. | |
Timer (const Timer &t_) | |
Copy constructor. | |
~Timer () | |
Destructor: do-nothing. | |
Timer & | operator= (const Timer &t_) |
Assignment operator. | |
bool | operator< (const Timer &t_) const |
Less-that by time. | |
bool | operator== (const Timer &t_) const |
Equal by time. | |
EventHandler * | getHandler () const |
Get EventHandler pointer. | |
const TimeVal & | getExpirationTime () const |
Get Expiration Time. | |
const TimeVal & | getDeltaTime () const |
Get Delta time. | |
void | rescheduleExpirationTime () |
Reschedule expiration time with Delta value. | |
void | dump (void) |
Dump contents to logfile. | |
void | set_id (const std::string &id_) |
Set Timer ID. | |
std::string | get_id () const |
Retrieve Timer ID. | |
Private Attributes | |
EventHandler * | m_eh |
Pointer to EventHandler. | |
TimeVal | m_timer |
When the timer should be triggered. | |
TimeVal | m_delta |
Absolute value used when Reactor needs to reschedule the timer. | |
std::string | m_id |
Timer's ID. |
Definition at line 35 of file Timer.h.
|
Default constructor.
Definition at line 110 of file Timer.h. References trace.
|
|
Constructor used by the TimerQueue.
Definition at line 118 of file Timer.h. References trace. 00120 : m_eh ((EventHandler*) eh_), m_timer (tm_), m_delta (delta_), m_id (name_) 00121 { 00122 trace("Timer::Timer(EH*, TV&)"); 00123 }
|
|
Copy constructor.
Definition at line 127 of file Timer.h. References trace. 00128 : m_eh (t_.m_eh), m_timer (t_.m_timer), 00129 m_delta (t_.m_delta), m_id (t_.m_id) 00130 { 00131 trace("Timer::Timer(Timer&)"); 00132 }
|
|
Destructor: do-nothing.
Definition at line 136 of file Timer.h. References trace. 00137 { 00138 trace("Timer::~Timer"); 00139 }
|
|
Dump contents to logfile.
Definition at line 177 of file Timer.h. References DL, ASSA::TimeVal::fmt_mm_ss_mls(), ASSA::TimeVal::fmtString(), ASSA::EventHandler::get_id(), get_id(), m_delta, m_eh, m_timer, and ASSA::REACT. Referenced by ASSA::PriorityQueue_STLPQ< T, Compare >::dump(), and ASSA::TimerQueue::expire(). 00178 { 00179 DL((REACT,"Timer %s (EH=%s) expires at %s (delta=%s)\n", 00180 get_id ().c_str (), 00181 m_eh->get_id ().c_str (), 00182 m_timer.fmtString ().c_str(), 00183 m_delta.fmt_mm_ss_mls ().c_str())); 00184 }
|
|
Retrieve Timer ID.
Definition at line 89 of file Timer.h. References m_id. Referenced by dump(). 00089 { return m_id; }
|
|
Get Delta time.
Definition at line 74 of file Timer.h. References m_delta. 00074 { return m_delta; }
|
|
Get Expiration Time.
Definition at line 71 of file Timer.h. References m_timer. Referenced by ASSA::TimerQueue::expire(), and ASSA::TimerQueue::top(). 00071 { return m_timer; }
|
|
Get EventHandler pointer.
Definition at line 68 of file Timer.h. References m_eh. Referenced by ASSA::PriorityQueue_STLPQ< T, Compare >::remove(). 00068 { return m_eh; }
|
|
Less-that by time.
Definition at line 155 of file Timer.h. References m_timer. 00156 { 00157 return m_timer < t_.m_timer; 00158 }
|
|
Assignment operator.
Definition at line 143 of file Timer.h. References m_delta, m_eh, m_id, and m_timer. 00144 { 00145 m_eh = t_.m_eh; 00146 m_timer = t_.m_timer; 00147 m_delta = t_.m_delta; 00148 m_id = t_.m_id; 00149 00150 return *this; 00151 }
|
|
Equal by time.
Definition at line 162 of file Timer.h. References m_timer. 00163 { 00164 return m_timer == t_.m_timer; 00165 }
|
|
Reschedule expiration time with Delta value.
Definition at line 169 of file Timer.h. References ASSA::TimeVal::gettimeofday(), m_delta, and m_timer. 00170 { 00171 TimeVal now (TimeVal::gettimeofday ()); 00172 m_timer = now + m_delta; 00173 }
|
|
Set Timer ID. ID allows Reactor and application-level code describe intelligently the kind of the Timer this is. Definition at line 85 of file Timer.h. References m_id. 00085 { m_id = id_; }
|
|
Absolute value used when Reactor needs to reschedule the timer.
Definition at line 99 of file Timer.h. Referenced by dump(), getDeltaTime(), operator=(), and rescheduleExpirationTime(). |
|
Pointer to EventHandler.
Definition at line 93 of file Timer.h. Referenced by dump(), getHandler(), and operator=(). |
|
Timer's ID.
Definition at line 102 of file Timer.h. Referenced by get_id(), operator=(), and set_id(). |
|
When the timer should be triggered.
Definition at line 96 of file Timer.h. Referenced by dump(), getExpirationTime(), operator<(), operator=(), operator==(), and rescheduleExpirationTime(). |