|
Open Inventor Reference
|
Sensor for one-time only callbacks. More...
#include <Inventor/sensors/SoOneShotSensor.h>
Public Member Functions | |
| SoOneShotSensor () | |
| Creation methods. | |
| SoOneShotSensor (SoSensorCB *func, void *data) | |
| Creation methods. | |
| virtual | ~SoOneShotSensor () |
| Destroys the sensor, freeing up any memory associated with it after unscheduling it. | |
Public Member Functions inherited from SoDelayQueueSensor | |
| SoDelayQueueSensor () | |
| Constructors. The second form takes standard callback function and data. | |
| SoDelayQueueSensor (SoSensorCB *func, void *data) | |
| virtual | ~SoDelayQueueSensor () |
| Destructor. | |
| void | setPriority (uint32_t pri) |
| Sets the priority of the sensor. | |
| uint32_t | getPriority () const |
| Gets the priority of the sensor. | |
| virtual void | schedule () |
| If this sensor's priority is non-zero, adds this sensor to the list of delay queue sensors ready to be triggered. | |
| virtual void | unschedule () |
| If this sensor is scheduled, removes it from the delay 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 delay queue to be triggered. | |
| virtual bool | isIdleOnly () const |
| This method is overridden by IdleSensors to tell sensor manager that they should only be processed when there really is idle time (and not when the delay queue timeout expires). | |
| void | setCounter (uint32_t c) |
| Set/inquire counter when sensor was last triggered. | |
| uint32_t | getCounter () const |
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. | |
| SoSensorCB * | getFunction () 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. | |
| void | setNextInQueue (SoSensor *next) |
| Sets/returns the next sensor in whichever queue the sensor is in. | |
| SoSensor * | getNextInQueue () const |
Additional Inherited Members | |
Static Public Member Functions inherited from SoDelayQueueSensor | |
| static uint32_t | getDefaultPriority () |
| Returns the default delay queue sensor priority, which is 100. | |
Static Public Member Functions inherited from SoSensor | |
| static void | initClass () |
| Initialize static members, etc. | |
Protected Member Functions inherited from SoDelayQueueSensor | |
| virtual void | trigger () |
| Triggers the sensor, calling its callback function. | |
Protected Attributes inherited from SoDelayQueueSensor | |
| bool | scheduled |
| Whether sensor is scheduled. | |
Protected Attributes inherited from SoSensor | |
| SoSensorCB * | func |
| Callback function. | |
| void * | funcData |
| Data to pass to callback. | |
A one-shot sensor is triggered once after it is scheduled, when the delay queue is processed. Like all delay queue sensors, one-shot sensors with a non-zero priority are just added to the delay queue when scheduled; if they are scheduled again before the delay queue is processed nothing happens, and they are guaranteed to be called only once when the delay queue is processed. For example, a one-shot sensor whose callback function redraws the scene might be scheduled whenever the scene graph changes and whenever a window-system event reporting that the window changed size occurs. By using a one-shot, the scene will only be redrawn once even if a window-changed-size event occurs just after the scene graph is modified (or if several window-changed-size events occur in a row).
Calling schedule() in the callback function is a useful way of getting something to happen repeatedly as often as possible, while still handling events and timeouts.
A priority 0 one-shot sensor isn't very useful, since scheduling it is exactly the same as directly calling its callback function.
Definition at line 94 of file SoOneShotSensor.h.
| SoOneShotSensor::SoOneShotSensor | ( | ) |
The second method takes the callback function and data to be called when the sensor is triggered.
| SoOneShotSensor::SoOneShotSensor | ( | SoSensorCB * | func, |
| void * | data | ||
| ) |
The second method takes the callback function and data to be called when the sensor is triggered.
|
virtual |