#include <Timer.h>
Classes | |
struct | Task |
Public Member Functions | |
void | invoke () |
Invoke Timer task. More... | |
virtual int | open (void *args) |
Create thread for Timer. More... | |
ListenerId | registerListener (ListenerBase *listener, TimeValue tm) |
Register listener. More... | |
ListenerId | registerListenerFunc (void(*cbf)(), TimeValue tm) |
Register listener. More... | |
template<class ListenerClass > | |
ListenerId | registerListenerObj (ListenerClass *obj, void(ListenerClass::*cbf)(), TimeValue tm) |
Register listener. More... | |
void | start () |
Start Timer task. More... | |
void | stop () |
Stop Timer task. More... | |
virtual int | svc (void) |
Thread execution function for Timer. More... | |
Timer (TimeValue &interval) | |
Constructor. More... | |
bool | unregisterListener (ListenerId id) |
Unregister listener. More... | |
virtual | ~Timer () |
Destructor. More... | |
Public Member Functions inherited from coil::Task | |
virtual void | activate () |
Create a thread. More... | |
virtual void | activate () |
Create a thread. More... | |
virtual int | close (unsigned long flags=0) |
Task close. More... | |
virtual int | close (unsigned long flags=0) |
Task close. More... | |
virtual void | finalize () |
Finalizing the task. More... | |
virtual void | finalize () |
Finalizing the task. More... | |
virtual void | reset () |
Reset of task count. More... | |
virtual void | reset () |
Reset of task count. More... | |
virtual int | resume (void) |
Resuming the suspended task. More... | |
virtual int | resume (void) |
Resuming the suspended task. More... | |
virtual int | suspend (void) |
Suspending the task. More... | |
virtual int | suspend (void) |
Suspending the task. More... | |
Task () | |
Constructor. More... | |
Task () | |
Constructor. More... | |
virtual int | wait (void) |
Waiting for the thread terminate. More... | |
virtual int | wait (void) |
Waiting for the thread terminate. More... | |
virtual | ~Task () |
Destructor. More... | |
virtual | ~Task () |
Destructor. More... | |
Private Types | |
typedef coil::Guard< Mutex > | Guard |
typedef coil::Mutex | Mutex |
Private Attributes | |
TimeValue | m_interval |
bool | m_running |
Mutex | m_runningMutex |
Mutex | m_taskMutex |
std::vector< Task > | m_tasks |
Additional Inherited Members | |
Static Public Member Functions inherited from coil::Task | |
static void * | svc_run (void *args=0) |
Start thread Execution. More... | |
static unsigned int WINAPI | svc_run (void *args=0) |
Start thread Execution. More... | |
Timer class.
Invoke the callback function of registered listener periodically at the set cycle.
|
private |
|
private |
coil::Timer::Timer | ( | TimeValue & | interval | ) |
void coil::Timer::invoke | ( | ) |
|
virtual |
ListenerId coil::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 |
|
inline |
|
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 |
void coil::Timer::start | ( | ) |
void coil::Timer::stop | ( | ) |
|
virtual |
Thread execution function for Timer.
Thread execution function for Timer. Invoke the callback function of registered listener.
Reimplemented from coil::Task.
bool coil::Timer::unregisterListener | ( | ListenerId | id | ) |