Open Inventor Reference
SoSensor Class Referenceabstract

Abstract base class for Inventor sensors. More...

#include <Inventor/sensors/SoSensor.h>

Inheritance diagram for SoSensor:
SoDelayQueueSensor SoTimerQueueSensor SoDataSensor SoIdleSensor SoOneShotSensor SoAlarmSensor SoTimerSensor SoFieldSensor SoNodeSensor SoPathSensor SoFieldSensorCallback SoTypedFieldSensorCallback< Object, Method >

Public Member Functions

 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
 

Static Public Member Functions

static void initClass ()
 Initialize static members, etc.
 

Protected Attributes

SoSensorCBfunc
 Callback function.
 
void * funcData
 Data to pass to callback.
 

Detailed Description

Sensors detect changes either to time or to Inventor objects in a scene graph, and call a user-defined callback function. Sensors are scheduled when the thing they are attached to changes, and sometime after they are scheduled they are triggered, calling the user's callback function.

See Also
SoAlarmSensor, SoDataSensor, SoFieldSensor, SoIdleSensor, SoNodeSensor, SoPathSensor, SoSensorManager

Definition at line 108 of file SoSensor.h.

Constructor & Destructor Documentation

◆ SoSensor() [1/2]

SoSensor::SoSensor ( )
inline

Definition at line 113 of file SoSensor.h.

◆ SoSensor() [2/2]

SoSensor::SoSensor ( SoSensorCB f,
void *  d 
)
inline

Definition at line 114 of file SoSensor.h.

◆ ~SoSensor()

virtual SoSensor::~SoSensor ( )
virtual

Member Function Documentation

◆ getData()

void * SoSensor::getData ( ) const
inline

Definition at line 131 of file SoSensor.h.

◆ getFunction()

SoSensorCB * SoSensor::getFunction ( ) const
inline

Definition at line 128 of file SoSensor.h.

◆ getNextInQueue()

SoSensor * SoSensor::getNextInQueue ( ) const
inline

Definition at line 155 of file SoSensor.h.

◆ initClass()

static void SoSensor::initClass ( )
static

◆ isBefore()

virtual bool SoSensor::isBefore ( const SoSensor s) const
pure virtual

◆ isScheduled()

virtual bool SoSensor::isScheduled ( ) const
pure virtual

Implemented in SoDelayQueueSensor, and SoTimerQueueSensor.

◆ schedule()

virtual void SoSensor::schedule ( )
pure virtual

◆ setData()

void SoSensor::setData ( void *  d)
inline

Definition at line 125 of file SoSensor.h.

◆ setFunction()

void SoSensor::setFunction ( SoSensorCB f)
inline

The function must take two arguments em user-supplied callback data (of type void *) and a pointer to the sensor that is triggering the function (of type SoSensor *).

Definition at line 123 of file SoSensor.h.

◆ setNextInQueue()

void SoSensor::setNextInQueue ( SoSensor next)
inline

Definition at line 154 of file SoSensor.h.

◆ trigger()

virtual void SoSensor::trigger ( )
virtual

◆ unschedule()

virtual void SoSensor::unschedule ( )
pure virtual

Member Data Documentation

◆ func

SoSensorCB* SoSensor::func
protected

Definition at line 158 of file SoSensor.h.

◆ funcData

void* SoSensor::funcData
protected

Definition at line 159 of file SoSensor.h.


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