Open Inventor Reference
SoDataSensor Class Reference

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

List of all members.

Public Member Functions

 SoDataSensor ()
 Constructors. The second form takes standard callback function and data.
 SoDataSensor (SoSensorCB *func, void *data)
virtual ~SoDataSensor ()
 Destructor.
void setDeleteCallback (SoSensorCB *f, void *data=NULL)
 Sets a callback that will be called when the object the sensor is sensing is deleted.
SoNodegetTriggerNode () const
 If this is a priority 0 data sensor, returns the node/field that was modified that caused this sensor to trigger.
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).
SoPathgetTriggerPath () const
 Returns the path from the node to which this sensor is attached down to the child node that changed.
void setTriggerPathFlag (SbBool flag)
SbBool getTriggerPathFlag () const
virtual void unschedule ()
 Override unschedule() to reset trigNode and trigPath.
virtual void trigger ()
 Override trigger to reset trigNode and trigPath, if necessary.
virtual void notify (SoNotList *list)
 Propagates modification notification through an instance.
virtual void dyingReference ()=0
 This is called when the base (path, field, node, whatever) is deleted.

Protected Member Functions

void invokeDeleteCallback ()
 Invokes the delete callback.

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::SoDataSensor ( )
SoDataSensor::SoDataSensor ( SoSensorCB func,
void *  data 
)
virtual SoDataSensor::~SoDataSensor ( ) [virtual]

Member Function Documentation

virtual void SoDataSensor::dyingReference ( ) [pure virtual]

All subclasses must implement this to do the right thing.

SoField* SoDataSensor::getTriggerField ( ) const
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.

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

SbBool SoDataSensor::getTriggerPathFlag ( ) const [inline]
See also:
getTriggerNode()

Definition at line 134 of file SoDataSensor.h.

void SoDataSensor::invokeDeleteCallback ( ) [protected]
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.

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

Definition at line 105 of file SoDataSensor.h.

void SoDataSensor::setTriggerPathFlag ( SbBool  flag) [inline]
See also:
getTriggerNode()

Definition at line 132 of file SoDataSensor.h.

virtual void SoDataSensor::trigger ( ) [virtual]

Reimplemented from SoDelayQueueSensor.

Reimplemented in SoFieldSensor.

virtual void SoDataSensor::unschedule ( ) [virtual]

Reimplemented from SoDelayQueueSensor.


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