Open Inventor Reference
SoDataSensor Class Referenceabstract

Abstract base class for sensors attached to parts of a scene. More...

#include <Inventor/sensors/SoDataSensor.h>

Inheritance diagram for SoDataSensor:
SoDelayQueueSensor SoSensor SoFieldSensor SoNodeSensor SoPathSensor SoFieldSensorCallback SoTypedFieldSensorCallback< Object, Method >

Public Member Functions

 SoDataSensor ()
 Constructors. The second form takes standard callback function and data. More...
 
 SoDataSensor (SoSensorCB *func, void *data)
 
virtual ~SoDataSensor ()
 Destructor. More...
 
void setDeleteCallback (SoSensorCB *f, void *data=NULL)
 Sets a callback that will be called when the object the sensor is sensing is deleted. More...
 
SoNodegetTriggerNode () const
 If this is a priority 0 data sensor, returns the node/field that was modified that caused this sensor to trigger. More...
 
SoFieldgetTriggerField () const
 Like getTriggerNode(), but returns the field that started notification (NULL if the sensor isn't priority 0 or if notification didn't start at a field). More...
 
SoPathgetTriggerPath () const
 Returns the path from the node to which this sensor is attached down to the child node that changed. More...
 
void setTriggerPathFlag (bool flag)
 
bool getTriggerPathFlag () const
 
virtual void unschedule ()
 Override unschedule() to reset trigNode and trigPath. More...
 
virtual void trigger ()
 Override trigger to reset trigNode and trigPath, if necessary. More...
 
virtual void notify (SoNotList *list)
 Propagates modification notification through an instance. More...
 
virtual void dyingReference ()=0
 This is called when the base (path, field, node, whatever) is deleted. More...
 
- Public Member Functions inherited from SoDelayQueueSensor
 SoDelayQueueSensor ()
 Constructors. The second form takes standard callback function and data. More...
 
 SoDelayQueueSensor (SoSensorCB *func, void *data)
 
virtual ~SoDelayQueueSensor ()
 Destructor. More...
 
void setPriority (uint32_t pri)
 Sets the priority of the sensor. More...
 
uint32_t getPriority () const
 Gets the priority of the sensor. More...
 
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. More...
 
virtual bool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in the delay queue to be triggered. More...
 
virtual bool isIdleOnly () const
 This method is overriden 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). More...
 
void setCounter (uint32_t c)
 Set/inquire counter when sensor was last triggered. More...
 
uint32_t getCounter () const
 
- 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...
 
SoSensorCBgetFunction () 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...
 
SoSensorgetNextInQueue () const
 

Protected Member Functions

void invokeDeleteCallback ()
 Invokes the delete callback. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SoDelayQueueSensor
static uint32_t getDefaultPriority ()
 Returns the default delay queue sensor priority, which is 100. More...
 
- Static Public Member Functions inherited from SoSensor
static void initClass ()
 Initialize static members, etc. More...
 
- Protected Attributes inherited from SoDelayQueueSensor
bool scheduled
 Whether sensor is scheduled. More...
 
- Protected Attributes inherited from SoSensor
SoSensorCBfunc
 Callback function. More...
 
void * funcData
 Data to pass to callback. More...
 

Detailed Description

Data sensors detect changes to scene graph objects (paths, nodes, or fields) and trigger their callback function when the object changes.

Data sensors provide a delete callback that is called just before the object the data sensor is attached to is deleted; note that the callback should not attempt to modify the object in any way, or core dumps may result.

Priority zero data sensors also provide methods that can be called in the callback function to determine exactly which node, field, or path caused the sensor to be triggered.

See Also
SoNodeSensor, SoPathSensor, SoFieldSensor, SoDelayQueueSensor

Definition at line 93 of file SoDataSensor.h.

Constructor & Destructor Documentation

◆ SoDataSensor() [1/2]

SoDataSensor::SoDataSensor ( )

◆ SoDataSensor() [2/2]

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

◆ ~SoDataSensor()

virtual SoDataSensor::~SoDataSensor ( )
virtual

Member Function Documentation

◆ dyingReference()

virtual void SoDataSensor::dyingReference ( )
pure virtual

All subclasses must implement this to do the right thing.

◆ getTriggerField()

SoField* SoDataSensor::getTriggerField ( ) const

◆ getTriggerNode()

SoNode* SoDataSensor::getTriggerNode ( ) const

Returns NULL if the sensor was not triggered because a node/field changed (for example, if schedule() is called on the sensor) or if this sensor is not a priority 0 sensor. Note that because one change to the scene graph may cause multiple nodes or fields to be modified (because of field-to-field connections), the node or field returned may not be the only one that changed.

◆ getTriggerPath()

SoPath* SoDataSensor::getTriggerPath ( ) const

setTriggerPathFlag(TRUE) must be called before the sensor is scheduled, or this will return NULL. It will also return NULL if the sensor is not immediate or if the notification doesn't go through a node

◆ getTriggerPathFlag()

bool SoDataSensor::getTriggerPathFlag ( ) const
inline
See also
getTriggerNode()

Definition at line 134 of file SoDataSensor.h.

◆ invokeDeleteCallback()

void SoDataSensor::invokeDeleteCallback ( )
protected

◆ notify()

virtual void SoDataSensor::notify ( SoNotList list)
virtual

By default, this schedules the sensor to be triggered and saves some information from the notification list for use by the callback function. Called by SoBase.

Reimplemented in SoPathSensor.

◆ setDeleteCallback()

void SoDataSensor::setDeleteCallback ( SoSensorCB f,
void *  data = NULL 
)
inline

Definition at line 105 of file SoDataSensor.h.

◆ setTriggerPathFlag()

void SoDataSensor::setTriggerPathFlag ( bool  flag)
inline
See also
getTriggerNode()

Definition at line 132 of file SoDataSensor.h.

◆ trigger()

virtual void SoDataSensor::trigger ( )
virtual

Reimplemented from SoDelayQueueSensor.

Reimplemented in SoFieldSensor.

◆ unschedule()

virtual void SoDataSensor::unschedule ( )
virtual

Reimplemented from SoDelayQueueSensor.


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