Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoDeviceContext.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-2019 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#if !defined SODEVICECONTEXT_H
24#define SODEVICECONTEXT_H
25
26#include <Inventor/SbBase.h>
27#include <Inventor/misc/SoRefCounter.h>
28#include <Inventor/STL/set>
29#include <Inventor/STL/list>
30#include <Inventor/threads/SbThread.h>
31#include <Inventor/threads/SbThreadMutex.h>
32#include <Inventor/threads/SbThreadSpinlock.h>
33#include <Inventor/devices/SoDeviceContextSharedGroup.h>
34
35#ifdef _WIN32
36#pragma warning(push)
37#pragma warning(disable:4251)
38#endif
39
40class SbThreadMutex;
41class SoBaseContextCache;
42
62{
63public:
64
69
73 virtual void bind() = 0;
74
78 virtual void unbind() = 0;
79
86 virtual bool isCompatible( SoDeviceContext* ) const = 0;
87
91 virtual bool isCurrent() const =0;
92
94 void setSharable( bool sharable );
95
97 bool isSharable() const;
98
100 virtual bool setSharedWith( SoDeviceContext* sourceCtx );
101
103 virtual bool isSharedWith( const SoDeviceContext* context ) const;
104
106 virtual int getSharedId() const;
107
110
113
119 virtual bool isValid() const;
120
121private:
122
123 virtual SbString getInfos();
124
125private:
129 virtual ~SoDeviceContext();
130
132 void lockContext();
133
135 void unlockContext();
136
137private:
138
140 SbThreadMutex m_mutex;
141
144
146 bool m_isSharable;
147
149};
150
151#ifdef _WIN32
152#pragma warning(pop)
153#endif
154
155#endif //#SODEVICECONTEXT_H
156
Class for smart character strings.
Definition SbString.h:202
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
virtual bool isCompatible(SoDeviceContext *) const =0
Returns true if two contexts are compatible.
void setSharable(bool sharable)
Sets the sharable property.
virtual bool setSharedWith(SoDeviceContext *sourceCtx)
Share this context.
friend class SoGLContext_qtcontext_OIV_875_Stub
virtual bool isCurrent() const =0
Returns true if the context is valid and currently active.
SoDeviceContextSharedGroup * getSharedGroup() const
Returns the current shared group.
SoDeviceContext()
Default constructor.
virtual void bind()=0
Bind this context to the current thread.
virtual void unbind()=0
Unbind this context from the current thread.
virtual int getSharedId() const
Returns an id common to all compatible/shared contexts.
virtual bool isSharedWith(const SoDeviceContext *context) const
Returns the current sharing state with passed context.
bool setSharedGroup(SoDeviceContextSharedGroup *sharedGroup)
Explicitly change the sharedGroup.
bool isSharable() const
Returns the sharable status of this context.
virtual bool isValid() const
Returns true if this context is valid.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Shared context m...
Base class for ref-counted objects.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90