Open Inventor Reference
|
Sensor that triggers callback repeatedly at regular intervals. More...
#include <Inventor/sensors/SoTimerSensor.h>
Public Member Functions | |
SoTimerSensor () | |
Creation methods. More... | |
SoTimerSensor (SoSensorCB *func, void *data) | |
Creation methods. More... | |
virtual | ~SoTimerSensor () |
Destroys the sensor, freeing up any memory associated with it after unscheduling it. More... | |
void | setBaseTime (const SbTime &base) |
Sets the base time. More... | |
void | setInterval (const SbTime &intvl) |
Get the interval. More... | |
const SbTime & | getBaseTime () const |
Get the base time. More... | |
const SbTime & | getInterval () const |
Get the interval. More... | |
virtual void | schedule () |
Overrides the regular schedule() method because we have to set up the trigger time first. More... | |
virtual void | unschedule () |
Overrides the regular unschedule() because the timer could be in either the timer queue or the waiting-to-be-rescheduled queue, depending on the state of the 'triggering' flag. More... | |
void | reschedule (const SbTime &) |
Reschedule this timer relative to the given time. More... | |
Public Member Functions inherited from SoTimerQueueSensor | |
SoTimerQueueSensor () | |
Constructors. The second form takes standard callback function and data. More... | |
SoTimerQueueSensor (SoSensorCB *func, void *data) | |
virtual | ~SoTimerQueueSensor () |
Destructor. More... | |
const SbTime & | getTriggerTime () const |
Returns the time at which this sensor is scheduled to 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... | |
SoSensorCB * | getFunction () 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... | |
SoSensor * | getNextInQueue () const |
Additional Inherited Members | |
Static Public Member Functions inherited from SoSensor | |
static void | initClass () |
Initialize static members, etc. More... | |
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. More... | |
Protected Attributes inherited from SoTimerQueueSensor | |
bool | scheduled |
Whether sensor is scheduled. More... | |
Protected Attributes inherited from SoSensor | |
SoSensorCB * | func |
Callback function. More... | |
void * | funcData |
Data to pass to callback. More... | |
Timer sensors trigger their callback function at regular intervals. For example, a timer might be setup to call its callback function every second on the second by setting the base time to SbTime(0.0) and the interval to SbTime(1.0). Timers are guaranteed to be triggered only once when the timer queue is processed, so if the application only processes the timer queue once every 5 seconds (because it is busy doing something else) the once-a-second sensor's callback will be called only once every 5 seconds.
Note also that SoTimers always schedule themselves to be triggered the next even multiple of the interval time after the base time; so, for example, if the once-a-second sensor is triggered at time 2.9 (because the application way busy doing something at time 2.0 and didn't get around to processing the sensor queue for a while) it will reschedule itself to go off at time 3.0, not at time 3.9. If the base time was never set, the sensor would be scheduled for time 3.9.
Definition at line 100 of file SoTimerSensor.h.
SoTimerSensor::SoTimerSensor | ( | ) |
The second method takes the callback function and data to be called when the sensor is triggered.
SoTimerSensor::SoTimerSensor | ( | SoSensorCB * | func, |
void * | data | ||
) |
The second method takes the callback function and data to be called when the sensor is triggered.
|
virtual |
|
inline |
Definition at line 124 of file SoTimerSensor.h.
|
inline |
Definition at line 126 of file SoTimerSensor.h.
void SoTimerSensor::reschedule | ( | const SbTime & | ) |
|
virtual |
Reimplemented from SoTimerQueueSensor.
|
inline |
The default base time is the time when the sensor is scheduled or rescheduled.
Definition at line 117 of file SoTimerSensor.h.
References TRUE.
|
inline |
The default interval is 1/30th of a second.
Definition at line 121 of file SoTimerSensor.h.
|
virtual |
Reimplemented from SoTimerQueueSensor.