Open Inventor
Release 2024.2.0
Loading...
Searching...
No Matches
SoSubTypedClass.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-2014 BY FEI S.A.S, ***
17
*** BORDEAUX, FRANCE ***
18
*** ALL RIGHTS RESERVED ***
19
**=======================================================================*/
20
/*=======================================================================
21
** Author : VSG (MMM YYYY)
22
**=======================================================================*/
23
#ifndef SO_TYPED_CLASS_
24
#define SO_TYPED_CLASS_
25
26
#include <Inventor/SoType.h>
27
28
29
#define SO_TYPED_CLASS_INTERNAL_HEADER() \
30
public: \
31
SoType getTypeId() const; \
32
static SoType getClassTypeId(); \
33
static void *createFromSoType(SoType* dynamicType = NULL); \
34
private: \
35
static SoType m_classTypeId; \
36
static SbBool m_isFirstTime
37
38
#define SO_TYPED_CLASS_HEADER() \
39
SO_TYPED_CLASS_INTERNAL_HEADER(); \
40
public: \
41
static void initClass(); \
42
static void exitClass()
43
44
#define SO_TYPED_CLASS_ABSTRACT_VARS(className) \
45
SoType className::m_classTypeId; \
46
SbBool className::m_isFirstTime = TRUE;
47
//
48
// Non-abstract nodes have all the stuff abstract nodes do
49
//
50
#define SO_TYPED_CLASS_VARS(className) \
51
SO_TYPED_CLASS_ABSTRACT_VARS(className)
52
53
#define SO_TYPED_CLASS_INTERNAL_SOURCE(parent, className, classPrintName) \
54
\
55
SO_TYPED_CLASS_ABSTRACT_VARS(className) \
56
\
57
SoType \
58
className::getTypeId() const \
59
{ \
60
return m_classTypeId; \
61
} \
62
\
63
SoType \
64
className::getClassTypeId() \
65
{ \
66
return m_classTypeId; \
67
} \
68
\
69
void * \
70
className::createFromSoType(SoType*) \
71
{ \
72
return (void *)(new className); \
73
}
74
75
#define SO_TYPED_CLASS_SOURCE(parentClass, className, classPrintName) \
76
SO_TYPED_CLASS_INTERNAL_SOURCE(parentClass,className,classPrintName) \
77
\
78
void \
79
className::initClass() \
80
{ \
81
SO_TYPED_CLASS_INIT_CLASS(className,classPrintName,parentClass) \
82
} \
83
\
84
void \
85
className::exitClass() \
86
{ \
87
SO_TYPED_CLASS_EXIT_CLASS(className) \
88
}
89
90
#define SO_TYPED_CLASS_ABSTRACT_INTERNAL_SOURCE(className) \
91
SO_TYPED_CLASS_ABSTRACT_VARS(className)
92
93
#define SO_TYPED_CLASS_ABSTRACT_SOURCE(className, classPrintName, parentClass) \
94
SO_TYPED_CLASS_ABSTRACT_INTERNAL_SOURCE(className) \
95
void \
96
className::initClass() \
97
{ \
98
SO_TYPED_CLASS_INIT_ABSTRACT_CLASS(className, classPrintName, parentClass) \
99
} \
100
\
101
void \
102
className::exitClass() \
103
{ \
104
SO_TYPED_CLASS_EXIT_ABSTRACT_CLASS(className) \
105
}
106
107
#define SO_TYPED_CLASS_ABSTRACT_INTERNAL_HEADER() \
108
public: \
109
virtual SoType getTypeId() const = 0; \
110
static SoType getClassTypeId() { return m_classTypeId; } \
111
\
112
private: \
113
static SoType m_classTypeId; \
114
static SbBool m_isFirstTime
115
116
#define SO_TYPED_CLASS_ABSTRACT_HEADER() \
117
SO_TYPED_CLASS_ABSTRACT_INTERNAL_HEADER(); \
118
public: \
119
static void initClass(); \
120
static void exitClass();
121
122
#define SO_TYPED_CLASS_INIT_ABSTRACT_CLASS(className,classPrintName,parentClass) \
123
if (m_isFirstTime) \
124
{ \
125
if (parentClass::getClassTypeId() == SoType::badType() ) \
126
parentClass::initClass(); \
127
m_classTypeId = SoType::createType(parentClass::getClassTypeId(), \
128
classPrintName, \
129
NULL); \
130
m_isFirstTime = FALSE; \
131
}
132
133
#define SO_TYPED_CLASS_EXIT_ABSTRACT_CLASS(className) \
134
SoType::removeType(m_classTypeId.getName()); \
135
m_classTypeId = SoType::badType(); \
136
m_isFirstTime = TRUE;
137
138
#define SO_TYPED_CLASS_INIT_CLASS(className,classPrintName,parentClass) \
139
if (m_isFirstTime) \
140
{ \
141
if (parentClass::getClassTypeId() == SoType::badType() ) \
142
parentClass::initClass(); \
143
m_classTypeId = SoType::createType(parentClass::getClassTypeId(), \
144
classPrintName, \
145
&className::createFromSoType); \
146
m_isFirstTime = FALSE; \
147
}
148
149
#define SO_TYPED_CLASS_EXIT_CLASS(className) \
150
SO_TYPED_CLASS_EXIT_ABSTRACT_CLASS(className)
151
152
#endif
153
154
Inventor
SoSubTypedClass.h
Generated by
1.9.8