112#define SO__NODE_CHECK_INIT(className) { \
113 if (classTypeId == SoType::badType()) { \
114 SoDebugError::post("SO_NODE_CONSTRUCTOR", \
115 "Can't construct a node of type " \
116 SO__QUOTE(className) \
117 " until initClass() has been called"); \
122#define SO__NODE_CHECK_CONSTRUCT(where) { \
123 if (fieldData == NULL) { \
124 SoDebugError::post(where, \
125 "Instance not properly constructed.\n" \
126 "Did you forget to put SO_NODE_CONSTRUCTOR()" \
127 " in the constructor?"); \
129 SoFieldData(parentFieldData ? *parentFieldData : NULL); \
134#define SO__NODE_CHECK_INIT(className) { }
135#define SO__NODE_CHECK_CONSTRUCT(where) { }
150#define SO_NODE_ABSTRACT_HEADER(className) \
152 typedef className InventorThisClass; \
153 static SoType getClassTypeId() \
154 { return classTypeId; } \
155 virtual SoType getTypeId() const; \
157 virtual const SoFieldData *getFieldData() const; \
158 static const SoFieldData **getFieldDataPtr() \
159 { return const_cast<const SoFieldData **>(&fieldData); } \
161 static SoType classTypeId; \
162 static bool firstInstance; \
163 static SoFieldData *fieldData; \
164 static const SoFieldData **parentFieldData
170#define SO_NODE_HEADER(className) \
171 SO_NODE_ABSTRACT_HEADER(className); \
172 static void *createInstance()
185#define SO__NODE_ABSTRACT_VARS(className) \
186 SoType className::classTypeId; \
187 SoFieldData *className::fieldData; \
188 const SoFieldData **className::parentFieldData; \
189 bool className::firstInstance = TRUE
194#define SO__NODE_VARS(className) \
195 SO__NODE_ABSTRACT_VARS(className)
202#define SO__NODE_ABSTRACT_METHODS(className) \
205 className::getTypeId() const \
207 return classTypeId; \
210 const SoFieldData * \
211 className::getFieldData() const \
213 SO__NODE_CHECK_CONSTRUCT(SO__QUOTE(className)); \
223#define SO__NODE_METHODS(className) \
225 SO__NODE_ABSTRACT_METHODS(className) \
228 className::createInstance() \
230 return static_cast<void *>(new className); \
240#define SO_NODE_SOURCE(className) \
241 SO__NODE_VARS(className); \
242 SO__NODE_METHODS(className)
244#define SO_NODE_ABSTRACT_SOURCE(className) \
245 SO__NODE_ABSTRACT_VARS(className); \
246 SO__NODE_ABSTRACT_METHODS(className)
254#define SO__NODE_INIT_CLASS(className,classPrintName,parentClass) { \
255 if ((SoNode::nextActionMethodIndex < 0) || \
256 (SoNode::nextActionMethodIndex > 32767)){ \
257 SoDebugError::post("SO__NODE_INIT_CLASS", \
258 "Overflow of SoNode::nextActionMethodIndex"); \
262 SoType::createType(parentClass::getClassTypeId(), \
264 &className::createInstance, \
265 static_cast<short>(SoNode::nextActionMethodIndex++)); \
266 parentFieldData = parentClass::getFieldDataPtr(); \
269#define SO__NODE_INIT_ABSTRACT_CLASS(className,classPrintName,parentClass) { \
270 if ((SoNode::nextActionMethodIndex < 0) || \
271 (SoNode::nextActionMethodIndex > 32767)){ \
272 SoDebugError::post("SO__NODE_INIT_ABSTRACT_CLASS", \
273 "Overflow of SoNode::nextActionMethodIndex"); \
277 SoType::createType(parentClass::getClassTypeId(), \
280 static_cast<short>(SoNode::nextActionMethodIndex++)); \
281 parentFieldData = parentClass::getFieldDataPtr(); \
292#define SO_NODE_INIT_CLASS(className,parentClass,parentPrintClass) { \
293 if ((SoNode::nextActionMethodIndex < 0) || \
294 (SoNode::nextActionMethodIndex > 32767)){ \
295 SoDebugError::post("SO_NODE_INIT_CLASS", \
296 "Overflow of SoNode::nextActionMethodIndex"); \
300 SoType::createType(SoType::fromName(parentPrintClass), \
301 SO__QUOTE(className), \
302 &className::createInstance, \
303 static_cast<short>(SoNode::nextActionMethodIndex++)); \
304 parentFieldData = parentClass::getFieldDataPtr(); \
307#define SO_NODE_INIT_ABSTRACT_CLASS(className, parentClass, parentPrintClass) { \
308 if ((SoNode::nextActionMethodIndex < 0) || \
309 (SoNode::nextActionMethodIndex > 32767)){ \
310 SoDebugError::post("SO_NODE_INIT_ABSTRACT_CLASS", \
311 "Overflow of SoNode::nextActionMethodIndex"); \
315 SoType::createType(SoType::fromName(parentPrintClass), \
316 SO__QUOTE(className), \
318 static_cast<short>(SoNode::nextActionMethodIndex++)); \
319 parentFieldData = parentClass::getFieldDataPtr(); \
328#define SO_NODE_CONSTRUCTOR(className) { \
329 SO__NODE_CHECK_INIT(className); \
330 if (fieldData == NULL) \
331 fieldData = new SoFieldData( \
332 parentFieldData ? *parentFieldData : NULL); \
334 firstInstance = FALSE; \
344#define SO_NODE_IS_FIRST_INSTANCE() \
345 (firstInstance == TRUE)
351#define SO_NODE_ADD_REMOVED_FIELD(fieldName) {\
353 fieldData->addRemovedFieldName(SO__QUOTE(fieldName)); \
372#define SO_NODE_ADD_FIELD(fieldName,defValue) { \
373 SO__NODE_CHECK_CONSTRUCT(__FILE__); \
375 fieldData->addField(this, SO__QUOTE(fieldName), \
377 this->fieldName.setValue defValue; \
378 this->fieldName.setContainer(this); \
388#define SO_NODE_ADD_ENUM_FIELD(field, type, defaultValue) \
389 SO_NODE_SET_SF_ENUM_TYPE(field, type);\
390 SO_NODE_ADD_FIELD(field, (defaultValue));
414#define SO_NODE_DEFINE_ENUM_VALUE(enumType,enumValue) { \
415 SO__NODE_CHECK_CONSTRUCT(__FILE__); \
417 fieldData->addEnumValue(SO__QUOTE(enumType), \
418 SO__QUOTE(enumValue), \
447#define SO_NODE_DEFINE_ENUM_VALUE_NAMED(enumType,enumValue,enumValueName) { \
448 SO__NODE_CHECK_CONSTRUCT(__FILE__); \
450 fieldData->addEnumValue(SO__QUOTE(enumType), \
479#define SO_NODE_DEFINE_ENUM_VALUE_SCOPED(enumScope,enumType,enumValue) { \
480 SO__NODE_CHECK_CONSTRUCT(__FILE__); \
482 fieldData->addEnumValue(SO__QUOTE(enumScope) "::" SO__QUOTE(enumType),\
483 SO__QUOTE(enumValue), \
484 enumScope::enumValue); \