Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoTimerSensor Class Reference

The SoTimerSensor class is a sensor which will trigger at given intervals. More...

#include <Inventor/sensors/SoTimerSensor.h>

Inheritance diagram for SoTimerSensor:
SoTimerQueueSensor SoSensor

Public Member Functions

 SoTimerSensor (void)
 
 SoTimerSensor (SoSensorCB *func, void *data)
 
virtual ~SoTimerSensor (void)
 
void setBaseTime (const SbTime &base)
 
const SbTimegetBaseTime (void) const
 
void setInterval (const SbTime &interval)
 
const SbTimegetInterval (void) const
 
virtual void schedule (void)
 
virtual void unschedule (void)
 
void reschedule (const SbTime &schedtime)
 
- Public Member Functions inherited from SoTimerQueueSensor
 SoTimerQueueSensor (void)
 
 SoTimerQueueSensor (SoSensorCB *func, void *data)
 
virtual ~SoTimerQueueSensor (void)
 
const SbTimegetTriggerTime (void) const
 
virtual SbBool isScheduled (void) const
 
- Public Member Functions inherited from SoSensor
 SoSensor (void)
 
 SoSensor (SoSensorCB *func, void *data)
 
virtual ~SoSensor (void)
 
void setFunction (SoSensorCB *callbackfunction)
 
SoSensorCBPtr getFunction (void) const
 
void setData (void *callbackdata)
 
void * getData (void) const
 
void setNextInQueue (SoSensor *next)
 
SoSensorgetNextInQueue (void) const
 

Additional Inherited Members

- Static Public Member Functions inherited from SoSensor
static void initClass (void)
 
- Protected Member Functions inherited from SoTimerQueueSensor
void setTriggerTime (const SbTime &time)
 
- Protected Attributes inherited from SoTimerQueueSensor
SbBool scheduled
 
- Protected Attributes inherited from SoSensor
SoSensorCBfunc
 
void * funcData
 

Detailed Description

The SoTimerSensor class is a sensor which will trigger at given intervals.

Use sensors of this class when you want a job repeated at a certain interval, without explicitly needing to reschedule the sensor (i.e. SoTimerSensor automatically re-schedules itself after it has been triggered).

SoTimerSensor instances is commonly used to trigger animation updates at a constant framerate.

Constructor & Destructor Documentation

◆ SoTimerSensor() [1/2]

SoTimerSensor::SoTimerSensor ( void  )

Default constructor. Sets up an interval of 1/30th of a second.

◆ SoTimerSensor() [2/2]

SoTimerSensor::SoTimerSensor ( SoSensorCB func,
void *  data 
)

Constructor taking as parameters the sensor callback function and the userdata which will be passed the callback.

See also
setFunction(), setData()

◆ ~SoTimerSensor()

SoTimerSensor::~SoTimerSensor ( void  )
virtual

Destructor.

Member Function Documentation

◆ setBaseTime()

void SoTimerSensor::setBaseTime ( const SbTime baseref)

Set the base trigger time.

If you use this method, the trigger times will be on intervals from the given value.

Without an explicitly set base time, the next trigger invocation after a trigger has happened will be on the current time plus the interval time. Note that this will of course cause the timer to drift.

See also
getBaseTime()

◆ getBaseTime()

const SbTime & SoTimerSensor::getBaseTime ( void  ) const

Returns the base trigger time.

See also
setBaseTime()

◆ setInterval()

void SoTimerSensor::setInterval ( const SbTime intervalref)

Sets the time interval between each time the sensor triggers.

See also
getInterval()

◆ getInterval()

const SbTime & SoTimerSensor::getInterval ( void  ) const

Returns the timer trigger interval.

See also
setInterval()

◆ schedule()

void SoTimerSensor::schedule ( void  )
virtual

Overrides the virtual schedule() method to be able to set up the base time, if this was not done by the user.

If no base time was set, base time will then equal the current time.

See also
unschedule(), isScheduled()

Reimplemented from SoTimerQueueSensor.

◆ unschedule()

void SoTimerSensor::unschedule ( void  )
virtual

Overrides the virtual unschedule() method to handle unschedule() calls during triggering.

Reimplemented from SoTimerQueueSensor.

◆ reschedule()

void SoTimerSensor::reschedule ( const SbTime schedtime)

Set new trigger time based on the given schedule time, and schedules the sensor for triggering.


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