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.
 
 SoTimerQueueSensor (SoSensorCB *func, void *data)
 
virtual ~SoTimerQueueSensor ()
 Destructor.
 
const SbTimegetTriggerTime () const
 Returns the time at which this sensor is scheduled to be triggered.
 
virtual void schedule ()
 Adds this sensor to the timer queue.
 
virtual void unschedule ()
 If this sensor is scheduled, removes it from the timer queue so that it will not be triggered.
 
virtual bool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in the timer queue to be triggered.
 
- Public Member Functions inherited from SoSensor
 SoSensor ()
 Constructors. The second form takes callback function and data.
 
 SoSensor (SoSensorCB *f, void *d)
 
virtual ~SoSensor ()
 Virtual destructor so that subclasses are deleted properly.
 
void setFunction (SoSensorCB *f)
 Sets the callback function that is called when the sensor is triggered.
 
void setData (void *d)
 Sets the callback data passed to the callback function.
 
SoSensorCBgetFunction () const
 Returns the callback function that will be called when the sensor is triggered.
 
void * getData () const
 Returns the user-supplied pointer that will be passed to the callback function.
 
virtual void schedule ()=0
 Schedules the sensor for triggering at the appropriate time.
 
virtual void unschedule ()=0
 Unschedules sensor to keep it from being triggered.
 
virtual bool isScheduled () const =0
 Returns whether the sensor is scheduled.
 
virtual void trigger ()
 Triggers the sensor, calling its callback function.
 
virtual bool isBefore (const SoSensor *s) const =0
 This returns TRUE if this sensor should precede sensor s in whichever queue this sensor would be in.
 
void setNextInQueue (SoSensor *next)
 Sets/returns the next sensor in whichever queue the sensor is in.
 
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.
 
virtual void trigger ()
 Triggers the sensor, calling its callback function.
 

Protected Attributes

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

Additional Inherited Members

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

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 SoAlarmSensor, and SoTimerSensor.

◆ 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: