SoOneShotSensor Class Reference
[Sensors]

Sensor for one-time only callbacks. More...

#include <Inventor/sensors/SoOneShotSensor.h>

Inheritance diagram for SoOneShotSensor:
SoDelayQueueSensor SoSensor

List of all members.

Public Member Functions

 SoOneShotSensor ()
 SoOneShotSensor (SoSensorCB *func, void *data)
virtual ~SoOneShotSensor ()

Detailed Description

Sensor for one-time only callbacks.

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 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 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 .

SEE ALSO

SoIdleSensor, SoDelayQueueSensor


Constructor & Destructor Documentation

SoOneShotSensor::SoOneShotSensor (  ) 

Default constructor.

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

Constructor that takes the callback function and data to be called when the sensor is triggered.

virtual SoOneShotSensor::~SoOneShotSensor (  )  [virtual]

Destroys the sensor, freeing up any memory associated with it after unscheduling it.


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

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/