Coin
4.0.3
Coin3D core library
|
The SoSensor class is the abstract base class for all sensors. More...
#include <Inventor/sensors/SoSensor.h>
Public Member Functions | |
SoSensor (SoSensorCB *func, void *data) | |
SoSensor (void) | |
virtual | ~SoSensor (void) |
void * | getData (void) const |
SoSensorCBPtr | getFunction (void) const |
SoSensor * | getNextInQueue (void) const |
virtual SbBool | isBefore (const SoSensor *s) const =0 |
virtual SbBool | isScheduled (void) const =0 |
virtual void | schedule (void)=0 |
void | setData (void *callbackdata) |
void | setFunction (SoSensorCB *callbackfunction) |
void | setNextInQueue (SoSensor *next) |
virtual void | trigger (void) |
virtual void | unschedule (void)=0 |
Static Public Member Functions | |
static void | initClass (void) |
Protected Attributes | |
SoSensorCB * | func |
void * | funcData |
The SoSensor class is the abstract base class for all sensors.
Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph.
See documentation of subclasses for insight into exactly for what types of events we can trigger sensor callbacks.
For most tasks where application programmers can use sensors, it is also possible to achieve the same results by using engines. There are a few important differences between sensors and engines, though:
Engines are considered part of the scene graph, and are written to file upon SoWriteAction export operations. Sensors, on the other hand, are not included in export operations.
Engines basically connects fields (and come with a lot of built-in functionality for combining and converting inputs and outputs), you just decide which engine you want, connect inputs and output and forget about it. Sensors are a lot more flexible in what you can do when they trigger, as control is transferred internally from Coin to your registered callback functions.
SoSensor::SoSensor | ( | void | ) |
Constructor.
SoSensor::SoSensor | ( | SoSensorCB * | funcptr, |
void * | data ) |
Constructor taking as parameters the sensor callback function func and the user data pointer which will be passed to the callback.
|
virtual |
Destructor.
Returns the user supplied callback function data pointer.
SoSensorCB * SoSensor::getFunction | ( | void | ) | const |
Returns the callback function pointer.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Open Inventor function not implemented in Coin.
Sets up initialization for static data for the sensors. Called by SoDB::init().
Returns TRUE
if this sensor should precede sensor s in its sensor queue.
|
pure virtual |
Check if this sensor is scheduled for triggering.
Implemented in SoDelayQueueSensor, and SoTimerQueueSensor.
Put the sensor in a queue to be triggered at a later time.
Implemented in SoAlarmSensor, SoDelayQueueSensor, SoTimerQueueSensor, and SoTimerSensor.
Set the user supplied data pointer which will be used as the first argument to the sensor callback function.
void SoSensor::setFunction | ( | SoSensorCB * | callbackfunction | ) |
Set the callback function pointer which will be used when the sensor is triggered.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Open Inventor function not implemented in Coin.
Trigger the sensor's callback function.
Reimplemented in SoDataSensor, SoDelayQueueSensor, SoFieldSensor, and SoTimerQueueSensor.
Remove sensor from queue. The sensor will not be triggered unless it is later rescheduled.
Implemented in SoDelayQueueSensor, SoTimerQueueSensor, and SoTimerSensor.
|
protected |
Function to be called when a sensor triggers.
|
protected |
Data passed to the callback function.