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 : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #if !defined SODEVICECONTEXT_H 00024 #define SODEVICECONTEXT_H 00025 00026 #include <Inventor/SbBase.h> 00027 #include <Inventor/misc/SoRefCounter.h> 00028 #include <Inventor/STL/set> 00029 #include <Inventor/STL/list> 00030 #include <Inventor/threads/SbThread.h> 00031 #include <Inventor/threads/SbThreadMutex.h> 00032 #include <Inventor/threads/SbThreadSpinlock.h> 00033 #include <Inventor/devices/SoDeviceContextSharedGroup.h> 00034 00035 class SbThreadMutex; 00036 class SoBaseContextCache; 00037 00065 class SoDeviceContext : public SoRefCounter 00066 { 00067 public: 00068 00072 SoDeviceContext(); 00073 00077 virtual void bind() = 0; 00078 00082 virtual void unbind() = 0; 00083 00090 virtual bool isCompatible( SoDeviceContext* ) const = 0; 00091 00095 virtual bool isCurrent() const =0; 00096 00098 void setSharable( bool sharable ); 00099 00101 bool isSharable() const; 00102 00104 virtual bool setSharedWith( SoDeviceContext* sourceCtx ); 00105 00107 virtual bool isSharedWith( const SoDeviceContext* context ) const; 00108 00110 virtual int getSharedId() const; 00111 00113 SoDeviceContextSharedGroup* getSharedGroup() const; 00114 00116 bool setSharedGroup(SoDeviceContextSharedGroup* sharedGroup); 00117 00118 private: 00119 00120 virtual bool isValid() const; 00121 00122 virtual SbString getInfos(); 00123 00124 private: 00128 virtual ~SoDeviceContext(); 00129 00131 void lockContext(); 00132 00134 void unlockContext(); 00135 00136 private: 00137 00139 SbThreadMutex m_mutex; 00140 00142 SoDeviceContextSharedGroup* m_sharedGroup; 00143 00145 bool m_isSharable; 00146 00147 friend class SoGLContext_qtcontext_OIV_875_Stub; 00148 }; 00149 00150 #endif //#SODEVICECONTEXT_H 00151 00152