Open Inventor Reference
|
#include <Inventor/system/SbSystem.h>
#include <Inventor/errors/SoDebugError.h>
#include <Inventor/fields/SoFieldData.h>
#include <Inventor/nodes/SoNode.h>
Go to the source code of this file.
Defines | |
#define | SO__NODE_CHECK_INIT(className) { int _value_false_node_check_init = 0; while(_value_false_node_check_init) {} } |
*** note: many of the macros use the "do { ... } while(0)" hack to define multiline blocks as a single statement of code that can be used anywhere and ended with a semicolon | |
#define | SO__NODE_CHECK_CONSTRUCT(where) { int _value_false_node_check_construct = 0; while(_value_false_node_check_construct) {} } |
#define | SO_NODE_ABSTRACT_HEADER(className) |
Macros to be called within the class definition header for a node subclass: | |
#define | SO_NODE_HEADER(className) |
Non-abstract classes have everything abstract classes have, plus a way to create an instance. | |
#define | SO__NODE_ABSTRACT_VARS(className) |
Macros to be called within the source file for a node subclass: | |
#define | SO__NODE_VARS(className) SO__NODE_ABSTRACT_VARS(className) |
Non-abstract nodes have all the stuff abstract nodes do. | |
#define | SO__NODE_ABSTRACT_METHODS(className) |
Methods on the abstract type. | |
#define | SO__NODE_METHODS(className) |
These implement the methods defined in SO_NODE_HEADER or SO_NODE_ABSTRACT_HEADER. | |
#define | SO_NODE_SOURCE(className) |
These include all the definitions required at file scope. | |
#define | SO_NODE_ABSTRACT_SOURCE(className) |
#define | SO__NODE_INIT_CLASS(className, classPrintName, parentClass) |
Internal initialization macros. | |
#define | SO__NODE_INIT_ABSTRACT_CLASS(className, classPrintName, parentClass) |
#define | SO_NODE_INIT_CLASS(className, parentClass, parentPrintClass) |
This initializes the type identifer variables defined in SO_NODE_HEADER or SO_NODE_ABSTRACT_HEADER. | |
#define | SO_NODE_INIT_ABSTRACT_CLASS(className, parentClass, parentPrintClass) |
#define | SO_NODE_CONSTRUCTOR(className) |
This is included at the beginning of a constructor, to do required initializations. | |
#define | SO_NODE_IS_FIRST_INSTANCE() (firstInstance == TRUE) |
This is a boolean value that can be tested in constructors. | |
#define | SO_NODE_ADD_FIELD(fieldName, defValue) |
This adds the info for a field to the SoFieldData and sets the default value for it. | |
#define | SO_NODE_DEFINE_ENUM_VALUE(enumType, enumValue) |
This registers a value of an enum type. |
#define SO__NODE_ABSTRACT_METHODS | ( | className | ) |
\ SoType \ className::getTypeId() const \ { \ return classTypeId; \ } \ \ const SoFieldData * \ className::getFieldData() const \ { \ SO__NODE_CHECK_CONSTRUCT(SO__QUOTE(className)); \ return fieldData; \ }
Definition at line 206 of file SoSubNode.h.
#define SO__NODE_ABSTRACT_VARS | ( | className | ) |
SoType className::classTypeId; \ SoFieldData *className::fieldData; \ const SoFieldData **className::parentFieldData; \ SbBool className::firstInstance = TRUE
This declares the static variables defined in SO_NODE_HEADER or SO_NODE_ABSTRACT_HEADER.
Definition at line 189 of file SoSubNode.h.
#define SO__NODE_CHECK_CONSTRUCT | ( | where | ) | { int _value_false_node_check_construct = 0; while(_value_false_node_check_construct) {} } |
Definition at line 140 of file SoSubNode.h.
#define SO__NODE_CHECK_INIT | ( | className | ) | { int _value_false_node_check_init = 0; while(_value_false_node_check_init) {} } |
Debugging macros (used by other macros in this file)
Definition at line 139 of file SoSubNode.h.
#define SO__NODE_INIT_ABSTRACT_CLASS | ( | className, | |
classPrintName, | |||
parentClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(parentClass::getClassTypeId(), \ classPrintName, \ NULL, \ SoNode::nextActionMethodIndex++); \ parentFieldData = parentClass::getFieldDataPtr(); \ } while (_value_false); \ }
Definition at line 270 of file SoSubNode.h.
#define SO__NODE_INIT_CLASS | ( | className, | |
classPrintName, | |||
parentClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(parentClass::getClassTypeId(), \ classPrintName, \ &className::createInstance, \ SoNode::nextActionMethodIndex++); \ parentFieldData = parentClass::getFieldDataPtr(); \ } while (_value_false); \ }
Definition at line 258 of file SoSubNode.h.
#define SO__NODE_METHODS | ( | className | ) |
\ SO__NODE_ABSTRACT_METHODS(className) \ \ void * \ className::createInstance() \ { \ return (void *)(new className); \ }
Definition at line 227 of file SoSubNode.h.
#define SO__NODE_VARS | ( | className | ) | SO__NODE_ABSTRACT_VARS(className) |
Definition at line 198 of file SoSubNode.h.
#define SO_NODE_ABSTRACT_HEADER | ( | className | ) |
public: \ static SoType getClassTypeId() /* Returns class type id */ \ { return classTypeId; } \ virtual SoType getTypeId() const; /* Returns type id */ \ protected: \ virtual const SoFieldData *getFieldData() const; \ static const SoFieldData **getFieldDataPtr() \ { return const_cast<const SoFieldData **>(&fieldData); } \ private: \ static SoType classTypeId; /* Type id */ \ static SbBool firstInstance; /* true until 2nd c'tor call */ \ static SoFieldData *fieldData; \ static const SoFieldData **parentFieldData
These defines type-identifier and naming variables and methods that all subclasses and abstract subclasses must support.
Definition at line 155 of file SoSubNode.h.
#define SO_NODE_ABSTRACT_SOURCE | ( | className | ) |
SO__NODE_ABSTRACT_VARS(className); \ SO__NODE_ABSTRACT_METHODS(className)
Definition at line 248 of file SoSubNode.h.
#define SO_NODE_ADD_FIELD | ( | fieldName, | |
defValue | |||
) |
{ \ int _value_false= 0; \ do { \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ } while (_value_false); \ }
The parameters are as follows: fieldName: the name of the field (as a member) defValue: the default value enclosed in parentheses
For example,
SO_NODE_ADD_FIELD(ambientColor, (0.2, 0.2, 0.2)); SO_NODE_ADD_FIELD(shininess, (0.0));
adds info about fields named ambientColor and shininess with the given default values.
Definition at line 359 of file SoSubNode.h.
#define SO_NODE_CONSTRUCTOR | ( | className | ) |
{ \ int _value_false= 0; \ do { \ SO__NODE_CHECK_INIT(className); \ if (fieldData == NULL) \ fieldData = new SoFieldData( \ parentFieldData ? *parentFieldData : NULL); \ else \ firstInstance = FALSE; \ isBuiltIn = FALSE; \ } while (_value_false); \ }
Definition at line 320 of file SoSubNode.h.
#define SO_NODE_DEFINE_ENUM_VALUE | ( | enumType, | |
enumValue | |||
) |
{ \ int _value_false= 0; \ do { \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addEnumValue(SO__QUOTE(enumType), \ SO__QUOTE(enumValue), \ enumValue); \ } while (_value_false); \ }
enumType: the name of the enum type enumValue: the name of a value of that enum type
If a node defines an enum, each of the enum's values should be registered using this macro. For example:
[ in MyNode.h file: ] class MyNode { ... enum Chipmunk { ALVIN, SIMON, THEODORE }; ... }
[ in constructor MyNode::MyNode(): ] SO_NODE_DEFINE_ENUM_VALUE(Chipmunk, ALVIN); SO_NODE_DEFINE_ENUM_VALUE(Chipmunk, SIMON); SO_NODE_DEFINE_ENUM_VALUE(Chipmunk, THEODORE);
Definition at line 393 of file SoSubNode.h.
#define SO_NODE_HEADER | ( | className | ) |
SO_NODE_ABSTRACT_HEADER(className); \ static void *createInstance()
Definition at line 174 of file SoSubNode.h.
#define SO_NODE_INIT_ABSTRACT_CLASS | ( | className, | |
parentClass, | |||
parentPrintClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(SoType::fromName(parentPrintClass), \ SO__QUOTE(className), \ NULL, \ SoNode::nextActionMethodIndex++); \ parentFieldData = parentClass::getFieldDataPtr(); \ } while (_value_false); \ }
Definition at line 302 of file SoSubNode.h.
#define SO_NODE_INIT_CLASS | ( | className, | |
parentClass, | |||
parentPrintClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(SoType::fromName(parentPrintClass), \ SO__QUOTE(className), \ &className::createInstance, \ SoNode::nextActionMethodIndex++); \ parentFieldData = parentClass::getFieldDataPtr(); \ } while (_value_false); \ }
This macro should be called from within initClass(). The parentClass argument should be the class that this subclass is derived from.
Definition at line 290 of file SoSubNode.h.
#define SO_NODE_IS_FIRST_INSTANCE | ( | ) | (firstInstance == TRUE) |
Definition at line 339 of file SoSubNode.h.
#define SO_NODE_SOURCE | ( | className | ) |
SO__NODE_VARS(className); \ SO__NODE_METHODS(className)
Definition at line 244 of file SoSubNode.h.