Open Inventor Reference
SoTimerQueueSensor Class Reference

Abstract base class for sensors dependent on time. More...

#include <Inventor/sensors/SoTimerQueueSensor.h>

Inheritance diagram for SoTimerQueueSensor:
SoSensor SoAlarmSensor SoTimerSensor

Public Member Functions

 SoTimerQueueSensor ()
 Constructors. The second form takes standard callback function and data. More...
 
 SoTimerQueueSensor (SoSensorCB *func, void *data)
 
virtual ~SoTimerQueueSensor ()
 Destructor. More...
 
const SbTimegetTriggerTime () const
 Returns the time at which this sensor is scheduled to be triggered. More...
 
virtual void schedule ()
 Adds this sensor to the timer queue. More...
 
virtual void unschedule ()
 If this sensor is scheduled, removes it from the timer queue so that it will not be triggered. More...
 
virtual bool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in the timer queue to be triggered. More...
 
- Public Member Functions inherited from SoSensor
 SoSensor ()
 Constructors. The second form takes callback function and data. More...
 
 SoSensor (SoSensorCB *f, void *d)
 
virtual ~SoSensor ()
 Virtual destructor so that subclasses are deleted properly. More...
 
void setFunction (SoSensorCB *f)
 Sets the callback function that is called when the sensor is triggered. More...
 
void setData (void *d)
 Sets the callback data passed to the callback function. More...
 
SoSensorCBgetFunction () const
 Returns the callback function that will be called when the sensor is triggered. More...
 
void * getData () const
 Returns the user-supplied pointer that will be passed to the callback function. More...
 
void setNextInQueue (SoSensor *next)
 Sets/returns the next sensor in whichever queue the sensor is in. More...
 
SoSensorgetNextInQueue () const
 

Protected Member Functions

void setTriggerTime (const SbTime &time)
 Used by subclasses to set the time at which the sensor is to be triggered. More...
 
virtual void trigger ()
 Triggers the sensor, calling its callback function. More...
 

Protected Attributes

bool scheduled
 Whether sensor is scheduled. More...
 
- Protected Attributes inherited from SoSensor
SoSensorCBfunc
 Callback function. More...
 
void * funcData
 Data to pass to callback. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SoSensor
static void initClass ()
 Initialize static members, etc. More...
 

Detailed Description

Timer queue sensors are sensors that trigger themselves at specific times. The timer queue is normally processed as part of a programs main loop when the program is not busy doing something else. Note that processing the timer queue is not asynchronous em the program must re-enter its main loop for timers to be triggered. When the timer queue is processed, all timers scheduled to go off at or before the current time are triggered once, in order from earliest to latest.

See Also
SoTimerSensor, SoAlarmSensor, SoIdleSensor, SoOneShotSensor, SoDataSensor

Definition at line 85 of file SoTimerQueueSensor.h.

Constructor & Destructor Documentation

◆ SoTimerQueueSensor() [1/2]

SoTimerQueueSensor::SoTimerQueueSensor ( )

◆ SoTimerQueueSensor() [2/2]

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

◆ ~SoTimerQueueSensor()

virtual SoTimerQueueSensor::~SoTimerQueueSensor ( )
virtual

Member Function Documentation

◆ getTriggerTime()

const SbTime& SoTimerQueueSensor::getTriggerTime ( ) const
inline

If the sensor is not scheduled the results are undefined.

Definition at line 97 of file SoTimerQueueSensor.h.

◆ isScheduled()

virtual bool SoTimerQueueSensor::isScheduled ( ) const
virtual

Implements SoSensor.

◆ schedule()

virtual void SoTimerQueueSensor::schedule ( )
virtual

Subclasses provide methods for setting when the sensor will be triggered.

Implements SoSensor.

Reimplemented in SoTimerSensor, and SoAlarmSensor.

◆ setTriggerTime()

void SoTimerQueueSensor::setTriggerTime ( const SbTime time)
protected

◆ trigger()

virtual void SoTimerQueueSensor::trigger ( )
protectedvirtual

This overrides the method in SoSensor because it has to reset the schedule flag before triggering.

Reimplemented from SoSensor.

◆ unschedule()

virtual void SoTimerQueueSensor::unschedule ( )
virtual

Implements SoSensor.

Reimplemented in SoTimerSensor.

Member Data Documentation

◆ scheduled

bool SoTimerQueueSensor::scheduled
protected

Definition at line 119 of file SoTimerQueueSensor.h.


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