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 : David Beilloin (Apr 2013) 00022 **=======================================================================*/ 00023 00024 #if !defined SO_SHARED_GROUP_REFERENCE_LIST_H 00025 #define SO_SHARED_GROUP_REFERENCE_LIST_H 00026 00027 #include <Inventor/SbBase.h> 00028 00029 class SoBaseContextCache; 00030 class SoDeviceContextSharedGroup; 00031 00032 #ifdef _MSC_VER 00033 #pragma warning( push ) 00034 #pragma warning(disable:4251) 00035 #endif 00036 00037 SoSharedGroupReferenceList 00038 { 00039 public: 00040 // Constructor 00041 SoSharedGroupReferenceList(); 00042 00043 // Destructor 00044 ~SoSharedGroupReferenceList(); 00045 00046 // Adds an element for the list 00047 // @param sharedGroup shared group to add element in 00048 // @param element element to add to the list 00049 // @return true if element has been inserted in the sharedgroup dependency list 00050 // false otherwise (element was already in another list). 00051 bool insert(SoDeviceContextSharedGroup* sharedGroup, SoBaseContextCache* element); 00052 00053 // Removes an element for the list 00054 // @param sharedGroup shared group to remove element from 00055 // @param element element to remove from the list 00056 // @return true if element has been removed from the sharedgroup dependency list 00057 // false otherwise (element was not in this sharedgroup list). 00058 bool remove(SoDeviceContextSharedGroup* sharedGroup, SoBaseContextCache* element); 00059 00060 // Returns true if the element is in the list 00061 bool contains(const SoDeviceContextSharedGroup* sharedGroup, const SoBaseContextCache* element) const; 00062 00063 // Return true if the list is empty 00064 bool isEmpty() const 00065 { return (m_headList==NULL); } 00066 00067 // Returns the head list element 00068 // usefull when iterating through the list to get a stop condition 00069 SoBaseContextCache* getHead() const 00070 { return m_headList; } 00071 00072 // Returns the number of element currently in the list 00073 // Nb: should be call for debugging only 00074 size_t getSize() const; 00075 00076 private: 00077 SoBaseContextCache* m_headList; 00078 }; 00079 00080 SoSharedGroupReference 00081 { 00082 public: 00083 // Constructor 00084 SoSharedGroupReference(); 00085 // Destructor. 00086 ~SoSharedGroupReference(); 00087 00088 // Returns true if this object is already linked to the given sharedGroup dependency list 00089 inline bool isLinkedTo(const SoDeviceContextSharedGroup* sharedGroup) const 00090 { return (m_sharedGroup==sharedGroup); } 00091 00092 private: 00093 SoDeviceContextSharedGroup* m_sharedGroup; 00094 SoBaseContextCache* m_next; 00095 SoBaseContextCache* m_previous; 00096 00097 friend class SoSharedGroupReferenceList; 00098 }; 00099 00100 00101 #ifdef _MSC_VER 00102 #pragma warning( pop ) 00103 #endif 00104 00105 #endif // SO_SHARED_GROUP_REFERENCE_LIST_H 00106 00107 00108