Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoListSensor.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas DAGUISE (Aug 2007)
22**=======================================================================*/
23
24
25#ifndef _SO_LIST_SENSOR_
26#define _SO_LIST_SENSOR_
27
28class SoBaseList;
29class SoNotList;
30
31#include <Inventor/sensors/SoSensor.h>
32
57class SoListSensor : public SoSensor
58{
59 public:
80
85
90 SoListSensor(SoSensorCB* func, void* data);
91
95 virtual ~SoListSensor();
96
100 void attach(SoBaseList* list);
101
105 void detach();
106
111 SoBaseList* getAttachedList() const { return m_list; }
112
118 void setDeleteCallback( SoSensorCB *f, void *data = NULL )
119 {
120 m_deleteFunc = f;
121 m_deleteData = data;
122 }
123
128
132 int getTriggerIndex() const;
133
134 private:
135
136 // Override trigger to reset trigNode and trigPath, if
137 // necessary.
138 virtual void trigger();
139
140 // Called by the attached list when it is about to be deleted
141 virtual void dyingReference();
142
143 // Schedules the sensor for triggering at the appropriate time
144 virtual void schedule() {};
145
146 // Unschedules sensor to keep it from being triggered
147 virtual void unschedule() {};
148
149 // This returns TRUE if this sensor should precede sensor s in
150 // whichever queue this sensor would be in.
151 virtual SbBool isBefore(const SoSensor*) const { return false; }
152
153 private:
154 // Invokes the delete callback
155 void invokeDeleteCallback();
156
157 private:
158
159 SoSensorCB *m_deleteFunc; // CB and data for when attached
160 void *m_deleteData; // is about to be deleted
161 ChangeType m_trigType;
162 int m_trigIndex;
163 SoBaseList* m_list;
164};
165
166#endif // _SO_LIST_SENSOR_
167
168
169
170
Maintains a list of pointers to instances of the SoBase classes.
Definition SoBaseList.h:79
Sensor class that can be attached to Open Inventor base lists.
ChangeType
Change type.
@ SET
A previously existing item has been replaced.
@ REMOVE
An item has been deleted.
@ TOUCH
A touch() call has been done on list.
@ INSERT
An item has been inserted.
@ COPY
The list is resulting of a list copy.
@ APPEND
An item has been appended to the list.
@ UNSPECIFIED
Unspecified change.
@ TRUNCATE
The list has been cleared.
SoListSensor(SoSensorCB *func, void *data)
Constructor that takes standard callback function and data.
SoBaseList * getAttachedList() const
Returns the list that this sensor is sensing, or NULL if it is not attached to any list.
void detach()
Unschedules this sensor (if it is scheduled) and makes it ignore changes to the list.
SoListSensor()
Constructor.
ChangeType getTriggerType() const
Returns the type of change that occurred.
virtual ~SoListSensor()
Destructor.
int getTriggerIndex() const
Returns the index of the item that was added, removed, inserted, set, ...
void attach(SoBaseList *list)
Makes this sensor detect changes to the given list.
void setDeleteCallback(SoSensorCB *f, void *data=NULL)
Sets a callback that will be called when the object the sensor is sensing is deleted.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
void SoSensorCB(void *data, SoSensor *sensor)
This typedef defines the calling sequence for all callbacks from sensors.
Definition SoSensor.h:68
int SbBool
Boolean type.
Definition SbBase.h:87