Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoTypedObject.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-2021 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Jerome Lague (Jan 2010)
22**=======================================================================*/
23
24
25#ifndef _SO_TYPED_OBJECT_
26#define _SO_TYPED_OBJECT_
27
28#include <Inventor/SoType.h>
29
50{
51public:
55 virtual SoType getTypeId() const = 0;
56
57 // Internal note: Only "if_cpp" is needed here.
58 // .NET and Java API do not use this class.
59
72 SbBool isOfType(const SoType &type) const
73 { return getTypeId().isDerivedFrom(type); }
74
90 template<typename TypedObjectClass>
92 {
93 return isOfType( TypedObjectClass::getClassTypeId() );
94 }
95
98 { return s_classTypeId; }
99
100private:
101
102 static void initClass();
103 static void exitClass();
104
105 static void checkDatabase( const char* className, void* thisPtr, SoType classType, SoType& classTypeId );
106
119 SbBool isOfType(const SbName& name) const
120 {
121 return getTypeId().isDerivedFrom(name);
122 }
123
124private:
126 virtual ~SoTypedObject();
127
128private:
129 static SoType s_classTypeId;
130 static bool s_isFirstTime;
131 static bool s_checkDatabase;
132};
133
134#endif /* _SO_TYPED_OBJECT_ */
135
136
Character string stored in a hash table.
Definition SbName.h:162
Stores runtime type information.
Definition SoType.h:98
SbBool isDerivedFrom(const SoType &t) const
Returns TRUE if the type is derived from type t.
Base class for object storing runtime type information.
SbBool isOfType() const
Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
virtual SoType getTypeId() const =0
Returns the type identifier for a specific instance.
SbBool isOfType(const SoType &type) const
Returns TRUE if this object is of the type specified in type or is derived from that type.
static SoType getClassTypeId()
Returns the type identifier for this class.
int SbBool
Boolean type.
Definition SbBase.h:87