Watchdog abstract base class. More...
#include <Watchdog.h>
Public Member Functions | |
void | reset_interval (const ACE_Time_Value &interval) |
long | schedule_timer (const void *act, const ACE_Time_Value &interval) |
long | schedule_timer (const void *act, const ACE_Time_Value &delay, const ACE_Time_Value &interval) |
int | cancel_timer (long timer_id) |
Cancel a specific timer. | |
void | cancel_all () |
Cancel all associated timers. | |
int | reset_timer_interval (long timer_id) |
Reset interval for a specific timer. | |
Protected Member Functions | |
Watchdog (const ACE_Time_Value &interval) | |
virtual | ~Watchdog () |
Protected Attributes | |
ACE_Time_Value | interval_ |
Current time interval. | |
Private Member Functions | |
virtual void | reschedule_deadline ()=0 |
Re-schedule timer with new interval. | |
bool | reactor_is_shut_down () const |
Watchdog abstract base class.
A Watchdog
object executes an operation each time a corresponding timer expires. The timer is managed by this class. However, it is the responsibility of the Watchdog
owner, for example, to run the ACE_Reactor
event loop. The Watchdog
timer will not fire, otherwise.
Definition at line 35 of file Watchdog.h.
OpenDDS::DCPS::Watchdog::Watchdog | ( | const ACE_Time_Value & | interval | ) | [explicit, protected] |
Definition at line 86 of file Watchdog.cpp.
00087 : ReactorInterceptor(TheServiceParticipant->reactor(), 00088 TheServiceParticipant->reactor_owner()) 00089 , interval_(interval) 00090 { 00091 }
OpenDDS::DCPS::Watchdog::~Watchdog | ( | ) | [protected, virtual] |
Definition at line 93 of file Watchdog.cpp.
void OpenDDS::DCPS::Watchdog::cancel_all | ( | ) |
Cancel all associated timers.
Definition at line 131 of file Watchdog.cpp.
References c, and OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue().
00132 { 00133 CancelCommand c(this, -1); 00134 execute_or_enqueue(c); 00135 }
int OpenDDS::DCPS::Watchdog::cancel_timer | ( | long | timer_id | ) |
Cancel a specific timer.
Definition at line 124 of file Watchdog.cpp.
References c, and OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue().
00125 { 00126 CancelCommand c(this, timer_id); 00127 execute_or_enqueue(c); 00128 return 1; 00129 }
bool OpenDDS::DCPS::Watchdog::reactor_is_shut_down | ( | ) | const [private, virtual] |
Implements OpenDDS::DCPS::ReactorInterceptor.
Definition at line 97 of file Watchdog.cpp.
References TheServiceParticipant.
00098 { 00099 return TheServiceParticipant->is_shut_down(); 00100 }
virtual void OpenDDS::DCPS::Watchdog::reschedule_deadline | ( | ) | [private, pure virtual] |
Re-schedule timer with new interval.
Implemented in OpenDDS::DCPS::DataReaderImpl_T< MessageType >::FilterDelayedHandler, OpenDDS::DCPS::OfferedDeadlineWatchdog, and OpenDDS::DCPS::RequestedDeadlineWatchdog.
Referenced by reset_interval().
void OpenDDS::DCPS::Watchdog::reset_interval | ( | const ACE_Time_Value & | interval | ) |
Reset the Watchdog
timer interval, i.e. time between recurring timer expirations.
ACE_Reactor
. Definition at line 102 of file Watchdog.cpp.
References interval_, and reschedule_deadline().
00103 { 00104 if (this->interval_ != interval) { 00105 this->interval_ = interval; 00106 this->reschedule_deadline(); 00107 } 00108 }
int OpenDDS::DCPS::Watchdog::reset_timer_interval | ( | long | timer_id | ) |
Reset interval for a specific timer.
Definition at line 137 of file Watchdog.cpp.
References c, OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue(), and interval_.
00138 { 00139 ResetCommand c(this, timer_id, interval_); 00140 execute_or_enqueue(c); 00141 return 0; 00142 }
long OpenDDS::DCPS::Watchdog::schedule_timer | ( | const void * | act, | |
const ACE_Time_Value & | delay, | |||
const ACE_Time_Value & | interval | |||
) |
Schedule with the Watchdog
timer delay and timer interval, i.e. time between recurring timer expirations.
Definition at line 115 of file Watchdog.cpp.
References c, OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue(), and OpenDDS::DCPS::ReactorInterceptor::wait().
00116 { 00117 long timer_id = -1; 00118 ScheduleCommand c(this, act, delay, interval, &timer_id); 00119 execute_or_enqueue(c); 00120 wait(); 00121 return timer_id; 00122 }
long OpenDDS::DCPS::Watchdog::schedule_timer | ( | const void * | act, | |
const ACE_Time_Value & | interval | |||
) |
Schedule with the Watchdog
timer interval, i.e. time between recurring timer expirations.
Definition at line 110 of file Watchdog.cpp.
00111 { 00112 return schedule_timer(act, interval, interval); 00113 }
ACE_Time_Value OpenDDS::DCPS::Watchdog::interval_ [protected] |
Current time interval.
Definition at line 78 of file Watchdog.h.
Referenced by OpenDDS::DCPS::RequestedDeadlineWatchdog::execute(), OpenDDS::DCPS::OfferedDeadlineWatchdog::execute(), reset_interval(), reset_timer_interval(), OpenDDS::DCPS::RequestedDeadlineWatchdog::schedule_timer(), and OpenDDS::DCPS::OfferedDeadlineWatchdog::schedule_timer().