00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Nicolas DAGUISE (Aug 2007) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_LIST_SENSOR_ 00026 #define _SO_LIST_SENSOR_ 00027 00028 class SoBaseList; 00029 class SoNotList; 00030 00031 #include <Inventor/sensors/SoSensor.h> 00032 00059 class SoListSensor : public SoSensor 00060 { 00061 public: 00063 enum ChangeType 00064 { 00066 UNSPECIFIED, 00068 APPEND, 00070 INSERT, 00072 SET, 00074 REMOVE, 00076 TRUNCATE, 00078 COPY, 00080 TOUCH 00081 }; 00082 00086 SoListSensor(); 00087 00092 SoListSensor(SoSensorCB* func, void* data); 00093 00097 virtual ~SoListSensor(); 00098 00102 void attach(SoBaseList* list); 00103 00107 void detach(); 00108 00113 SoBaseList* getAttachedList() const { return m_list; } 00114 00120 void setDeleteCallback( SoSensorCB *f, void *data = NULL ) 00121 { 00122 m_deleteFunc = f; 00123 m_deleteData = data; 00124 } 00125 00129 ChangeType getTriggerType() const; 00130 00134 int getTriggerIndex() const; 00135 00136 private: 00137 00138 // Override trigger to reset trigNode and trigPath, if 00139 // necessary. 00140 virtual void trigger(); 00141 00142 // Called by the attached list when it is about to be deleted 00143 virtual void dyingReference(); 00144 00145 // Schedules the sensor for triggering at the appropriate time 00146 virtual void schedule() {}; 00147 00148 // Unschedules sensor to keep it from being triggered 00149 virtual void unschedule() {}; 00150 00151 // This returns TRUE if this sensor should precede sensor s in 00152 // whichever queue this sensor would be in. 00153 virtual SbBool isBefore(const SoSensor*) const { return false; } 00154 00155 private: 00156 // Invokes the delete callback 00157 void invokeDeleteCallback(); 00158 00159 private: 00160 00161 SoSensorCB *m_deleteFunc; // CB and data for when attached 00162 void *m_deleteData; // is about to be deleted 00163 ChangeType m_trigType; 00164 int m_trigIndex; 00165 SoBaseList* m_list; 00166 }; 00167 00168 #endif // _SO_LIST_SENSOR_ 00169 00170 00171 00172 00173