#include <Watchdog.h>
Inheritance diagram for OpenDDS::DCPS::Watchdog:


Public Member Functions | |
| void | reset_interval (const ACE_Time_Value &interval) |
| long | schedule_timer (const void *act, 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 | |
| int | handle_timeout (const ACE_Time_Value &, const void *act) |
| virtual void | execute (const void *act, bool timer_called)=0 |
| virtual void | reschedule_deadline ()=0 |
| Re-schedule timer with new interval. | |
| bool | reactor_is_shut_down () const |
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 33 of file Watchdog.h.
| OpenDDS::DCPS::Watchdog::Watchdog | ( | const ACE_Time_Value & | interval | ) | [explicit, protected] |
Definition at line 80 of file Watchdog.cpp.
00081 : ReactorInterceptor(TheServiceParticipant->reactor(), 00082 TheServiceParticipant->reactor_owner()) 00083 , interval_(interval) 00084 { 00085 }
| OpenDDS::DCPS::Watchdog::~Watchdog | ( | ) | [protected, virtual] |
| void OpenDDS::DCPS::Watchdog::cancel_all | ( | ) |
Cancel all associated timers.
Definition at line 120 of file Watchdog.cpp.
References OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue().
Referenced by OpenDDS::DCPS::DataWriterImpl::set_qos(), and OpenDDS::DCPS::DataReaderImpl::set_qos().
00121 { 00122 CancelCommand c(this, -1); 00123 execute_or_enqueue(c); 00124 }
| int OpenDDS::DCPS::Watchdog::cancel_timer | ( | long | timer_id | ) |
Cancel a specific timer.
Definition at line 113 of file Watchdog.cpp.
References OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue().
Referenced by OpenDDS::DCPS::RequestedDeadlineWatchdog::cancel_timer(), and OpenDDS::DCPS::OfferedDeadlineWatchdog::cancel_timer().
00114 { 00115 CancelCommand c(this, timer_id); 00116 execute_or_enqueue(c); 00117 return 1; 00118 }
| virtual void OpenDDS::DCPS::Watchdog::execute | ( | const void * | act, | |
| bool | timer_called | |||
| ) | [private, pure virtual] |
Operation to be executed when the associated timer expires or whenever samples are received/sent. The timer_called flag indicates if it's called from reator handle_timeout() or upon a sample receiving/sending.
Implemented in OpenDDS::DCPS::OfferedDeadlineWatchdog, and OpenDDS::DCPS::RequestedDeadlineWatchdog.
Referenced by handle_timeout().
| int OpenDDS::DCPS::Watchdog::handle_timeout | ( | const ACE_Time_Value & | , | |
| const void * | act | |||
| ) | [inline, private] |
Definition at line 41 of file Watchdog.h.
References execute().
00042 { 00043 return execute(act, true), 0; 00044 }
| bool OpenDDS::DCPS::Watchdog::reactor_is_shut_down | ( | ) | const [private, virtual] |
Implements OpenDDS::DCPS::ReactorInterceptor.
Definition at line 91 of file Watchdog.cpp.
References TheServiceParticipant.
00092 { 00093 return TheServiceParticipant->is_shut_down(); 00094 }
| virtual void OpenDDS::DCPS::Watchdog::reschedule_deadline | ( | ) | [private, pure virtual] |
Re-schedule timer with new interval.
Implemented in OpenDDS::DCPS::OfferedDeadlineWatchdog, and OpenDDS::DCPS::RequestedDeadlineWatchdog.
Referenced by reset_interval().
| void OpenDDS::DCPS::Watchdog::reset_interval | ( | const ACE_Time_Value & | interval | ) |
ACE_Reactor. Definition at line 96 of file Watchdog.cpp.
References interval_, and reschedule_deadline().
Referenced by OpenDDS::DCPS::DataWriterImpl::set_qos(), and OpenDDS::DCPS::DataReaderImpl::set_qos().
00097 { 00098 if (this->interval_ != interval) { 00099 this->interval_ = interval; 00100 this->reschedule_deadline(); 00101 } 00102 }
| int OpenDDS::DCPS::Watchdog::reset_timer_interval | ( | long | timer_id | ) |
Reset interval for a specific timer.
Definition at line 126 of file Watchdog.cpp.
References OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue(), and interval_.
00127 { 00128 ResetCommand c(this, timer_id, interval_); 00129 execute_or_enqueue(c); 00130 return 0; 00131 }
| 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 104 of file Watchdog.cpp.
References OpenDDS::DCPS::ReactorInterceptor::execute_or_enqueue(), and OpenDDS::DCPS::ReactorInterceptor::wait().
Referenced by OpenDDS::DCPS::RequestedDeadlineWatchdog::schedule_timer(), and OpenDDS::DCPS::OfferedDeadlineWatchdog::schedule_timer().
00105 { 00106 long timer_id = -1; 00107 ScheduleCommand c(this, act, interval, &timer_id); 00108 execute_or_enqueue(c); 00109 wait(); 00110 return timer_id; 00111 }
ACE_Time_Value OpenDDS::DCPS::Watchdog::interval_ [protected] |
Current time interval.
Definition at line 82 of file Watchdog.h.
Referenced by OpenDDS::DCPS::RequestedDeadlineWatchdog::execute(), OpenDDS::DCPS::OfferedDeadlineWatchdog::execute(), reset_interval(), and reset_timer_interval().
1.4.7