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-2014 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 00057 class SoListSensor : public SoSensor 00058 { 00059 public: 00061 enum ChangeType 00062 { 00064 UNSPECIFIED, 00066 APPEND, 00068 INSERT, 00070 SET, 00072 REMOVE, 00074 TRUNCATE, 00076 COPY, 00078 TOUCH 00079 }; 00080 00084 SoListSensor(); 00085 00090 SoListSensor(SoSensorCB* func, void* data); 00091 00095 virtual ~SoListSensor(); 00096 00100 void attach(SoBaseList* list); 00101 00105 void detach(); 00106 00111 SoBaseList* getAttachedList() const { return m_list; } 00112 00118 void setDeleteCallback( SoSensorCB *f, void *data = NULL ) 00119 { 00120 m_deleteFunc = f; 00121 m_deleteData = data; 00122 } 00123 00127 ChangeType getTriggerType() const; 00128 00132 int getTriggerIndex() const; 00133 00134 private: 00135 00136 // Override trigger to reset trigNode and trigPath, if 00137 // necessary. 00138 virtual void trigger(); 00139 00140 // Called by the attached list when it is about to be deleted 00141 virtual void dyingReference(); 00142 00143 // Schedules the sensor for triggering at the appropriate time 00144 virtual void schedule() {}; 00145 00146 // Unschedules sensor to keep it from being triggered 00147 virtual void unschedule() {}; 00148 00149 // This returns TRUE if this sensor should precede sensor s in 00150 // whichever queue this sensor would be in. 00151 virtual SbBool isBefore(const SoSensor*) const { return false; } 00152 00153 private: 00154 // Invokes the delete callback 00155 void invokeDeleteCallback(); 00156 00157 private: 00158 00159 SoSensorCB *m_deleteFunc; // CB and data for when attached 00160 void *m_deleteData; // is about to be deleted 00161 ChangeType m_trigType; 00162 int m_trigIndex; 00163 SoBaseList* m_list; 00164 }; 00165 00166 #endif // _SO_LIST_SENSOR_ 00167 00168 00169 00170 00171