LightWrap++
AC++wrapperfortheLightWave3DSDK
lwpp::Timer Class Reference

Adds timer based events to LightWave. More...

#include <timer.h>

+ Inheritance diagram for lwpp::Timer:
+ Collaboration diagram for lwpp::Timer:

List of all members.

Public Member Functions

template<typename T >
void addTimer (T *host, unsigned long interval)
virtual bool available () const
 Check if the global is available.
virtual LWTimer * getGlobal ()
 Get the pointer to the global.
LWTimer * operator-> ()
 Get the pointer to the global.
template<typename T >
void removeTimer (T *host, unsigned long interval=0)

Protected Member Functions

bool _acquireGlobal ()

Static Protected Attributes

static LWTimer * globPtr
 Pointer to the global functions.

Detailed Description

Adds timer based events to LightWave.

The functions expect the adress of a class that implements a member function with the signature "bool TimerEvent()". This functions returns true if it should be removed, false if it shall be called again after the next interval.


Member Function Documentation

bool lwpp::GlobalBase< LWTimer >::_acquireGlobal ( )
inlineprotectedinherited
template<typename T >
void lwpp::Timer::addTimer ( T *  host,
unsigned long  interval 
)
inline
Parameters:
*hostcallback class for timer expiration. This must have a bool TimerEvent() function implemented
intervaltimeout value expressed in milliseconds
virtual bool lwpp::GlobalBase< LWTimer >::available ( ) const
inlinevirtualinherited

Check if the global is available.

virtual LWTimer * lwpp::GlobalBase< LWTimer >::getGlobal ( )
inlinevirtualinherited

Get the pointer to the global.

LWTimer * lwpp::GlobalBase< LWTimer >::operator-> ( )
inlineinherited

Get the pointer to the global.

template<typename T >
void lwpp::Timer::removeTimer ( T *  host,
unsigned long  interval = 0 
)
inline

Timers can be explicitly removed by calling the following function and specifying the 'host' as well as an optional interval. If interval is 0, then the first instance of a timer with 'proc' as its callback will be removed. If interval is >0, then only the 'proc' instance with that interval will be removed.

Unless the timer instance implicitly removes itself by returning 1 from its callback function, each call to timerAdd() MUST HAVE a corresponding call to timerRemove(), Otherwise you run the risk of leaving a dangling function pointer within Layout, which can (and probably will) eventually lead to a crash of the application.

Parameters:
*hostcallback class for timer expiration. This must have a int TimerEvent() function implemented
intervaltimeout value expressed in milliseconds (same used for timerAdd())

Member Data Documentation

LWTimer * lwpp::GlobalBase< LWTimer >::globPtr
staticprotectedinherited

Pointer to the global functions.


The documentation for this class was generated from the following file: