OpenMAMA C++ API
Wombat::MamaTimer Class Reference

A repeating timer. More...

#include <MamaTimer.h>

Public Member Functions

 MamaTimer (void)
 
virtual ~MamaTimer (void)
 
virtual void create (MamaQueue *queue, MamaTimerCallback *callback, mama_f64_t interval, void *closure=NULL)
 Create a repeating timer. More...
 
virtual void destroy ()
 Destroy (stop) the timer. More...
 
virtual bool isActive () const
 Return whether the timer is active. More...
 
virtual void reset ()
 Reset the timer to the beginning of the interval. More...
 
virtual void setInterval (mama_f64_t intervalSeconds)
 Set the timer to use a different interval (and reset to the beginning of that interval). More...
 
virtual mama_f64_t getInterval () const
 Get the current timer interval. More...
 
virtual MamaTimerCallbackgetCallback () const
 Return the callback for the timer. More...
 
virtual void * getClosure () const
 Return the closure for the timer. More...
 
mamaTimer getCValue ()
 
const mamaTimer getCValue () const
 

Detailed Description

A repeating timer.

The callback will be repeatedly called at the specified interval until the timer is destroyed. To restart the timer after destroying it if destroy(), use create(). To reset the timer to the beginning of the given interval, use reset(). To set the timer to a different interval, use setInterval().

The MAMA timer relies on underlying middleware so its resolution is also dependent on the middleware.

Constructor & Destructor Documentation

§ MamaTimer()

Wombat::MamaTimer::MamaTimer ( void  )

§ ~MamaTimer()

virtual Wombat::MamaTimer::~MamaTimer ( void  )
virtual

Member Function Documentation

§ create()

virtual void Wombat::MamaTimer::create ( MamaQueue queue,
MamaTimerCallback callback,
mama_f64_t  interval,
void *  closure = NULL 
)
virtual

Create a repeating timer.

The interval is in seconds.

The queue is the queue from which the timer event will be dispatched.

Parameters
queueThe queue.
callbackThe callback.
intervalThe interval in seconds.
closureThe caller supplied closure.

§ destroy()

virtual void Wombat::MamaTimer::destroy ( )
virtual

Destroy (stop) the timer.

This function must be called from the same thread dispatching on the associated event queue unless both the default queue and dispatch queue are not actively dispatching.

§ isActive()

virtual bool Wombat::MamaTimer::isActive ( ) const
virtual

Return whether the timer is active.

§ reset()

virtual void Wombat::MamaTimer::reset ( )
virtual

Reset the timer to the beginning of the interval.

§ setInterval()

virtual void Wombat::MamaTimer::setInterval ( mama_f64_t  intervalSeconds)
virtual

Set the timer to use a different interval (and reset to the beginning of that interval).

§ getInterval()

virtual mama_f64_t Wombat::MamaTimer::getInterval ( ) const
virtual

Get the current timer interval.

§ getCallback()

virtual MamaTimerCallback* Wombat::MamaTimer::getCallback ( ) const
virtual

Return the callback for the timer.

Returns
the callback.

§ getClosure()

virtual void* Wombat::MamaTimer::getClosure ( ) const
virtual

Return the closure for the timer.

Returns
the closure.

§ getCValue() [1/2]

mamaTimer Wombat::MamaTimer::getCValue ( )

§ getCValue() [2/2]

const mamaTimer Wombat::MamaTimer::getCValue ( ) const