Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoListSensor Class Reference

Sensor class that can be attached to Open Inventor base lists. More...

#include <Inventor/sensors/SoListSensor.h>

+ Inheritance diagram for SoListSensor:

Public Types

enum  ChangeType {
  UNSPECIFIED ,
  APPEND ,
  INSERT ,
  SET ,
  REMOVE ,
  TRUNCATE ,
  COPY ,
  TOUCH
}
 Change type. More...
 

Public Member Functions

 SoListSensor ()
 Constructor.
 
 SoListSensor (SoSensorCB *func, void *data)
 Constructor that takes standard callback function and data.
 
virtual ~SoListSensor ()
 Destructor.
 
void attach (SoBaseList *list)
 Makes this sensor detect changes to the given list.
 
void detach ()
 Unschedules this sensor (if it is scheduled) and makes it ignore changes to the list.
 
SoBaseListgetAttachedList () const
 Returns the list that this sensor is sensing, or NULL if it is not attached to any list.
 
void setDeleteCallback (SoSensorCB *f, void *data=NULL)
 Sets a callback that will be called when the object the sensor is sensing is deleted.
 
ChangeType getTriggerType () const
 Returns the type of change that occurred.
 
int getTriggerIndex () const
 Returns the index of the item that was added, removed, inserted, set, ...
 
- Public Member Functions inherited from SoSensor
 SoSensor ()
 Constructor.
 
 SoSensor (SoSensorCB *f, void *d)
 Constructor that takes standard callback function and data.
 
void setFunction (SoSensorCB *f, void *userData)
 
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 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 SbBool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in a sensor queue to be triggered.
 

Detailed Description

Sensor class that can be attached to Open Inventor base lists.

List sensors detect changes to SoBaseList derived lists (field list, engine list, ...) and trigger their callback when the list changes.

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

List sensors also provide methods that can be called in the callback to determine exactly which item of the list caused the sensor to be triggered.

SEE ALSO

SbPList, SoSensor

Definition at line 57 of file SoListSensor.h.

Member Enumeration Documentation

◆ ChangeType

Change type.

Enumerator
UNSPECIFIED 

Unspecified change.

APPEND 

An item has been appended to the list.

INSERT 

An item has been inserted.

SET 

A previously existing item has been replaced.

REMOVE 

An item has been deleted.

TRUNCATE 

The list has been cleared.

COPY 

The list is resulting of a list copy.

TOUCH 

A touch() call has been done on list.

Definition at line 61 of file SoListSensor.h.

Constructor & Destructor Documentation

◆ SoListSensor() [1/2]

SoListSensor::SoListSensor ( )

Constructor.

◆ SoListSensor() [2/2]

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

Constructor that takes standard callback function and data.

◆ ~SoListSensor()

virtual SoListSensor::~SoListSensor ( )
virtual

Destructor.

Member Function Documentation

◆ attach()

void SoListSensor::attach ( SoBaseList list)

Makes this sensor detect changes to the given list.

◆ detach()

void SoListSensor::detach ( )

Unschedules this sensor (if it is scheduled) and makes it ignore changes to the list.

◆ getAttachedList()

SoBaseList * SoListSensor::getAttachedList ( ) const
inline

Returns the list that this sensor is sensing, or NULL if it is not attached to any list.

Definition at line 111 of file SoListSensor.h.

◆ getTriggerIndex()

int SoListSensor::getTriggerIndex ( ) const

Returns the index of the item that was added, removed, inserted, set, ...

◆ getTriggerType()

ChangeType SoListSensor::getTriggerType ( ) const

Returns the type of change that occurred.

◆ setDeleteCallback()

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

Sets a callback that will be called when the object the sensor is sensing is deleted.

Definition at line 118 of file SoListSensor.h.


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