TIBCO Adapter SDK C++ Reference
MTimer::MTimer
MTimer
Constructor for creating MTimer instances. This constructor is not associated with any sessions. By default the timer is started as soon as the MTimer instance is constructed. If you do not want to activate the timer set bMustActivate to false . Applications can deactivate the MTimer by calling MTimer::deactivate().
Remarks
If you use a timer, you should also create an instance of MEventListener with the appropriate onEvent() method to serve as the event handler and associate the timer and the listener by calling the timer’s inherited addListener() method. See MEventSource::addListener().

Timers are used in applications that poll based on a continuous interval instead of, for example, listening for data.

A timer name must be unique across one MApp application manager.

The following code fragment generates a repeating timer, which triggers at 2 second intervals, and the corresponding event listener.

 

int nInterval = 2;
m_pMTimer = new MTimer( this, "my_timer", nInterval, true );
m_pMTimer->addListener( m_pTimerEventHandler );
Parameters
Parameters Description
MApp* pMApp Pointer to MApp application manager for this MTimer.
const MString& rsName Name of this timer. Must be unique.
unsigned long ulInterval Interval of this timer activity, in milliseconds.
Mboolean bRepeating = Mtrue If set to true (the default), create a repeating timer. A repeating timer reschedules itself each time it triggers; the effect is a potentially endless series of timer events at a regular interval. If set to false , it is triggered only once.
Mboolean bMustActivate = Mtrue When set to true (the default) this timer is created as an active timer. Otherwise, applications have to explicitly call the activate() method.

Exceptions
M_ERROR_DATA_INVALID_PARAMETER_VALUE

MException on any failure to create or activate the timer.

Declaration
MTimer(MApp* pMApp, const MString& rsName, unsigned long ulInterval, Mboolean bRepeating = Mtrue, Mboolean bMustActivate = Mtrue) throw(MException);
Links
Copyright (c) 2010 TIBCO Software Inc. All rights reserved.