Open Inventor Reference
SoAlarmSensor Class Reference

Triggers a callback once sometime in the future. More...

#include <Inventor/sensors/SoAlarmSensor.h>

Inheritance diagram for SoAlarmSensor:
SoTimerQueueSensor SoSensor

Public Member Functions

 SoAlarmSensor ()
 Creation methods.
 
 SoAlarmSensor (SoSensorCB *func, void *data)
 Creation methods.
 
virtual ~SoAlarmSensor ()
 Destroys the sensor, freeing up any memory associated with it after unscheduling it.
 
void setTime (const SbTime &absTime)
 Sets the sensor to go off at the specified time.
 
void setTimeFromNow (const SbTime &relTime)
 Sets the sensor to go off the given amount of time from now.
 
const SbTimegetTime () const
 Returns the time the sensor is scheduled to be triggered.
 
virtual void schedule ()
 Overrides the regular schedule() method because we have to set up the trigger time first.
 
- Public Member Functions inherited from SoTimerQueueSensor
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from SoSensor
static void initClass ()
 Initialize static members, etc.
 
- Protected Member Functions inherited from SoTimerQueueSensor
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 inherited from SoTimerQueueSensor
bool scheduled
 Whether sensor is scheduled.
 
- Protected Attributes inherited from SoSensor
SoSensorCBfunc
 Callback function.
 
void * funcData
 Data to pass to callback.
 

Detailed Description

This type of sensor can be used to schedule a one-time callback for some time in the future. The sensor is not guaranteed to be called at exactly that time, but will be called sometime after the specified time.

See Also
SoOneShotSensor, SoTimerSensor, SoTimerQueueSensor, SbTime

Definition at line 80 of file SoAlarmSensor.h.

Constructor & Destructor Documentation

◆ SoAlarmSensor() [1/2]

SoAlarmSensor::SoAlarmSensor ( )

The second method takes the callback function and data to be called when the sensor is triggered.

◆ SoAlarmSensor() [2/2]

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

The second method takes the callback function and data to be called when the sensor is triggered.

◆ ~SoAlarmSensor()

virtual SoAlarmSensor::~SoAlarmSensor ( )
virtual

Member Function Documentation

◆ getTime()

const SbTime & SoAlarmSensor::getTime ( ) const
inline

This differs from getTriggerTime() in that this method returns the time the sensor was set to be scheduled, even if it has not yet been scheduled.

Definition at line 113 of file SoAlarmSensor.h.

◆ schedule()

virtual void SoAlarmSensor::schedule ( )
virtual

Reimplemented from SoTimerQueueSensor.

◆ setTime()

void SoAlarmSensor::setTime ( const SbTime absTime)

You must also call schedule() for the sensor to be triggered. If the sensor is already scheduled, it must be unscheduled and then rescheduled for the change in the trigger time to take effect.

◆ setTimeFromNow()

void SoAlarmSensor::setTimeFromNow ( const SbTime relTime)

You must also call schedule() for the sensor to be triggered. If the sensor is already scheduled, it must be unscheduled and then rescheduled for the change in the trigger time to take effect.


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