Open Inventor
Release 2024.2.0
Loading...
Searching...
No Matches
SoSubEvent.h
1
/*=======================================================================
2
* Copyright 1991-1996, Silicon Graphics, Inc.
3
* ALL RIGHTS RESERVED
4
*
5
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
6
* States. Use of a copyright notice is precautionary only and does not
7
* imply publication or disclosure.
8
*
9
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10
* Use, duplication or disclosure by the Government is subject to restrictions
11
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
14
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16
*
17
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21
* GRAPHICS, INC.
22
**=======================================================================*/
23
/*=======================================================================
24
** Author : David Mott (MMM yyyy)
25
**=======================================================================*/
26
/*=======================================================================
27
*** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28
*** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29
*** ***
30
*** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31
*** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32
*** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33
*** ***
34
*** RESTRICTED RIGHTS LEGEND ***
35
*** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36
*** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37
*** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38
*** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39
*** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40
*** ***
41
*** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42
*** BORDEAUX, FRANCE ***
43
*** ALL RIGHTS RESERVED ***
44
**=======================================================================*/
45
/*=======================================================================
46
** Modified by : VSG (MMM YYYY)
47
**=======================================================================*/
48
49
50
#ifndef _SO_SUB_EVENT_
51
#define _SO_SUB_EVENT_
52
53
#include <Inventor/events/SoEvent.h>
54
#include <Inventor/SoType.h>
55
#include <Inventor/misc/SoBasic.h>
56
#if defined(_DEBUG)
57
#include <Inventor/errors/SoDebugError.h>
58
#endif
59
60
// *** note: many of the macros use the "do { ... } while(0)"
61
// *** hack to define multiline blocks as a single statement
62
// *** of code that can be used anywhere and ended with a semicolon
63
65
//
66
// Macros to be called within the class definition header for an event
67
// subclass:
68
//
69
71
//
72
// These defines type-identifier and naming variables and methods that
73
// all subclasses and abstract subclasses must support.
74
//
75
76
#define SO_EVENT_HEADER() \
77
public: \
78
\
79
static SoType getClassTypeId(); \
80
\
81
virtual SoType getTypeId() const; \
82
private: \
83
static SoType classTypeId
/* Type id */
84
85
87
//
88
// Macros to be called within the source file for an event subclass:
89
//
90
92
//
93
// This declares the static variables defined in SO_EVENT_HEADER
94
//
95
96
#define SO__EVENT_VARS(className) \
97
SoType className::classTypeId;
98
99
101
//
102
// Methods on the type
103
//
104
105
#define SO__EVENT_METHODS(className) \
106
\
107
SoType \
108
className::getTypeId() const \
109
{ \
110
return classTypeId; \
111
} \
112
\
113
SoType \
114
className::getClassTypeId() \
115
{ \
116
return classTypeId; \
117
}
118
120
//
121
// These include all the definitions required
122
// at file scope
123
//
124
125
#define SO_EVENT_SOURCE(className) \
126
SO__EVENT_VARS(className); \
127
SO__EVENT_METHODS(className)
128
129
130
#if defined(_DEBUG)
131
#define SO_EVENT_INIT_CLASS_CHECK_PARENT(className, parentClass) \
132
if (parentClass::getClassTypeId().isBad()) { \
133
SoDebugError::post( SO__QUOTE(className)"::initClass", \
134
SO__QUOTE(className)" initialized before parent class " \
135
SO__QUOTE(parentClass)"\n"); \
136
parentClass::initClass(); \
137
}
138
#else
139
#define SO_EVENT_INIT_CLASS_CHECK_PARENT(className, parentClass) \
140
if (parentClass::getClassTypeId().isBad()) \
141
parentClass::initClass()
142
#endif
143
145
//
146
// This initializes the type identifer variables defined in
147
// SO_EVENT_HEADER . This macro should be called from within initClass().
148
// The parentClass argument should be the class that this subclass is
149
// derived from.
150
//
151
152
#define SO_EVENT_INIT_CLASS_INTERNAL(className,parentClass) \
153
SO_EVENT_INIT_CLASS_CHECK_PARENT(className, parentClass); \
154
classTypeId = SoType::createType(parentClass::getClassTypeId(), SO__QUOTE(className))
155
156
#define SO_EVENT_INIT_CLASS(className,parentClass) \
157
SO_EVENT_INIT_CLASS_INTERNAL(className,parentClass);
158
159
#if defined(_DEBUG)
160
#define SO_EVENT_EXIT_CLASS(className) \
161
if (! SoType::removeType(classTypeId.getName())) { \
162
SoDebugError::post(SO__QUOTE(className)"::exitClass", \
163
"Unable to remove type (%s) for this class. Check exitClass() " \
164
"method is implemented and is called only once.\n", \
165
classTypeId.getName().getString() ); \
166
} \
167
else \
168
classTypeId = SoType::badType()
169
#else
170
#define SO_EVENT_EXIT_CLASS(className) \
171
SoType::removeType(classTypeId.getName()); \
172
classTypeId = SoType::badType()
173
#endif
174
175
#endif
/* _SO_SUB_EVENT_ */
176
Inventor
events
SoSubEvent.h
Generated by
1.9.8