#include <Timer.h>
Public Member Functions | |
Timer (TimeValue &interval) | |
Constructor. | |
virtual | ~Timer () |
Destructor. | |
virtual int | open (void *args) |
Create thread for Timer. | |
virtual int | svc (void) |
Thread execution function for Timer. | |
void | start () |
Start Timer task. | |
void | stop () |
Stop Timer task. | |
void | invoke () |
Invoke Timer task. | |
ListenerId | registerListener (ListenerBase *listener, TimeValue tm) |
Register listener. | |
template<class ListenerClass> | |
ListenerId | registerListenerObj (ListenerClass *obj, void(ListenerClass::*cbf)(), TimeValue tm) |
Register listener. | |
ListenerId | registerListenerFunc (void(*cbf)(), TimeValue tm) |
Register listener. | |
bool | unregisterListener (ListenerId id) |
Unregister listener. | |
Classes | |
struct | Task |
Invoke the callback function of registered listener periodically at the set cycle.
RTC::Timer::Timer | ( | TimeValue & | interval | ) |
Constructor.
Constructor
interval | The interval of timer |
virtual RTC::Timer::~Timer | ( | ) | [virtual] |
Destructor.
Destructor
virtual int RTC::Timer::open | ( | void * | args | ) | [virtual] |
virtual int RTC::Timer::svc | ( | void | ) | [virtual] |
void RTC::Timer::invoke | ( | ) |
Invoke Timer task.
Subtract the interval of timer from the waiting time for invocation of each registered listener. If the listener whose waiting time reached 0 exists, invoke the callback function.
ListenerId RTC::Timer::registerListener | ( | ListenerBase * | listener, | |
TimeValue | tm | |||
) |
Register listener.
Register the listener of callback function invoked from this Timer by specifying the interval. If the same listener has already been regiseterd, the value specified the invocation interval of listener will be updated.
listener | Listener for the registration | |
tm | The invocation interval of listener |
ListenerId RTC::Timer::registerListenerObj | ( | ListenerClass * | obj, | |
void(ListenerClass::*)() | cbf, | |||
TimeValue | tm | |||
) | [inline] |
Register listener.
Register listener by specifying the object for callback, the method for callback and the invocation interval.
obj | Target object for callback | |
cbf | Target method for callback | |
tm | The invocation interval of listener |
ListenerId RTC::Timer::registerListenerFunc | ( | void(*)() | cbf, | |
TimeValue | tm | |||
) | [inline] |
Register listener.
Register listener by specifying the method for callback and the invocation interval.
cbf | Target method for callback | |
tm | The invocation interval of listener |
bool RTC::Timer::unregisterListener | ( | ListenerId | id | ) |
Unregister listener.
Unregister the listener specified by ID. If the listener specified by ID is not registerd, false will be returned.
id | ID of the unregisterd listener |