#include <Inventor/errors/SoDebugError.h>
#include <Inventor/fields/SoFieldData.h>
#include <Inventor/threads/SbThreadLocalStorage.h>
#include <Inventor/threads/SbThreadMutex.h>
Go to the source code of this file.
Defines | |
#define | SO__NODE_CHECK_INIT(className) |
#define | SO__NODE_CHECK_CONSTRUCT(where) |
#define | SO_NODE_ABSTRACT_HEADER(className) |
#define | SO_NODE_HEADER(className) |
#define | SO__NODE_ABSTRACT_VARS(className) |
#define | SO__NODE_VARS(className) SO__NODE_ABSTRACT_VARS(className) |
#define | SO__NODE_ABSTRACT_METHODS(className) |
#define | SO__NODE_METHODS(className) |
#define | SO_NODE_SOURCE(className) |
#define | SO_NODE_ABSTRACT_SOURCE(className) |
#define | SO_NODE_INIT_CLASS_CHECK_PARENT(className, parentClass) |
#define | SO__NODE_INIT_CLASS_INTERNAL(className, classPrintName, parentClass) |
#define | SO__NODE_INIT_CLASS(className, classPrintName, parentClass) SO__NODE_INIT_CLASS_INTERNAL(className,classPrintName,parentClass) |
#define | SO__NODE_INIT_ABSTRACT_CLASS_INTERNAL(className, classPrintName, parentClass) |
#define | SO__NODE_INIT_ABSTRACT_CLASS(className, classPrintName, parentClass) SO__NODE_INIT_ABSTRACT_CLASS_INTERNAL(className,classPrintName,parentClass) |
#define | SO__NODE_EXIT_CLASS(className) |
#define | SO_THREAD_NODE_INIT_CLASS(className, structName) |
#define | SO_THREAD_NODE_EXIT_CLASS(className) |
#define | LOCAL_THREAD_VAR(_className_, _structName_, _varName_) |
#define | LOCAL_THREAD_STORAGE(_className_) |
#define | SO_NODE_INIT_CLASS_INTERNAL(className, parentClass, parentPrintClass) |
#define | SO_NODE_INIT_CLASS(className, parentClass, parentPrintClass) |
#define | SO_NODE_INIT_ABSTRACT_CLASS_INTERNAL(className, parentClass, parentPrintClass) |
#define | SO_NODE_INIT_ABSTRACT_CLASS(className, parentClass, parentPrintClass) |
#define | SO_NODE_CONSTRUCTOR(className) |
#define | SO_NODE_IS_FIRST_INSTANCE() |
#define | CHECK_FIELD_INIT(fieldName) |
#define | CHECK_MFIELD_INIT(fieldName) |
#define | SO_NODE_ADD_FIELD(fieldName, defValue) |
#define | SO_NODE_ADD_NAMED_FIELD(fieldName, memberName, defValue) |
#define | SO_NODE_ADD_MFIELD(fieldName) |
#define | SO_NODE_ADD_PRIVATEFIELD(fieldName, defValue) |
#define | SO_NODE_ADD_PRIVATEMFIELD(fieldName) |
#define | SO_NODE_ADD_EXPOSEDFIELD(fieldName, defValue) |
#define | SO_NODE_ADD_EVENTIN(fieldName) |
#define | SO_NODE_ADD_EVENTOUT(fieldName, defValue) |
#define | SO_NODE_ADD_HIDDEN_FIELD(fieldName, defValue) |
#define | SO_NODE_ADD_FIELD_EVENTIN(fieldName, defValue) |
#define | SO_NODE_DEFINE_ENUM_VALUE(enumType, enumValue) |
#define | SO__NODE_DEFINE_ENUM_VALUE(enumType, enumValueName, enumValue) |
#define CHECK_FIELD_INIT | ( | fieldName | ) |
This adds the info for a field to the SoFieldData and sets the default value for it.
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.
#define CHECK_MFIELD_INIT | ( | fieldName | ) |
#define LOCAL_THREAD_STORAGE | ( | _className_ | ) |
\ GET_THREAD_LOCAL_STORAGE(_className_)
#define LOCAL_THREAD_VAR | ( | _className_, | |||
_structName_, | |||||
_varName_ | ) |
\ GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_)
#define SO__NODE_ABSTRACT_METHODS | ( | className | ) |
\ SoType \ className::getTypeId() const \ { \ return classTypeId; \ } \ \ const SoFieldData * \ className::getFieldData() const \ { \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(SO__QUOTE(className)); \ SoFieldData * result = fieldData; \ classMutex.unlock(); \ return result; \ } \ \ SbBool className::getIsBuiltIn() const \ { \ return isBuiltIn; \ } \ \ const SoFieldData **className::getFieldDataPtr() \ { \ classMutex.lock(); \ const SoFieldData **result = (const SoFieldData **)&fieldData; \ classMutex.unlock(); \ return result; \ }
#define SO__NODE_ABSTRACT_VARS | ( | className | ) |
SbThreadMutex className::classMutex; \ SoType className::classTypeId; \ SbBool className::isBuiltIn = FALSE; \ SoFieldData *className::fieldData = NULL; \ const SoFieldData **className::parentFieldData = NULL; \ SbBool className::firstInstance = TRUE;
#define SO__NODE_CHECK_CONSTRUCT | ( | where | ) |
{ \ if (fieldData == NULL) { \ fieldData = new SoFieldData(parentFieldData ? *parentFieldData : NULL); \ } \ }
#define SO__NODE_CHECK_INIT | ( | className | ) |
{ \ if (classTypeId.isBad()) { \ className::initClass(); \ } \ }
#define SO__NODE_DEFINE_ENUM_VALUE | ( | enumType, | |||
enumValueName, | |||||
enumValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addEnumValue(SO__QUOTE(enumType), \ enumValueName, \ enumValue); \ classMutex.unlock(); \ }
#define SO__NODE_EXIT_CLASS | ( | className | ) |
SoType::removeType(classTypeId.getName()); \ classTypeId = SoType::badType(); \ if (fieldData != NULL) \ { \ delete fieldData; \ fieldData = NULL; \ } \ parentFieldData = NULL; \ firstInstance = TRUE
#define SO__NODE_INIT_ABSTRACT_CLASS | ( | className, | |||
classPrintName, | |||||
parentClass | ) | SO__NODE_INIT_ABSTRACT_CLASS_INTERNAL(className,classPrintName,parentClass) |
#define SO__NODE_INIT_ABSTRACT_CLASS_INTERNAL | ( | className, | |||
classPrintName, | |||||
parentClass | ) |
classMutex.lock(); \ SO_NODE_INIT_CLASS_CHECK_PARENT(className, parentClass); \ classTypeId = SoType::createType( parentClass::getClassTypeId(), \ classPrintName, \ NULL, \ (short)SoNode::getNextActionMethodIndex()); \ if (parentFieldData == NULL) \ SoNode::incNextActionMethodIndex(); \ parentFieldData = parentClass::getFieldDataPtr(); \ classMutex.unlock();
#define SO__NODE_INIT_CLASS | ( | className, | |||
classPrintName, | |||||
parentClass | ) | SO__NODE_INIT_CLASS_INTERNAL(className,classPrintName,parentClass) |
#define SO__NODE_INIT_CLASS_INTERNAL | ( | className, | |||
classPrintName, | |||||
parentClass | ) |
classMutex.lock(); \ SO_NODE_INIT_CLASS_CHECK_PARENT(className, parentClass); \ classTypeId = SoType::createType( parentClass::getClassTypeId(), \ classPrintName, \ &className::createInstance, \ (short)SoNode::getNextActionMethodIndex()); \ if (parentFieldData == NULL) \ SoNode::incNextActionMethodIndex(); \ parentFieldData = parentClass::getFieldDataPtr(); \ classMutex.unlock();
#define SO__NODE_METHODS | ( | className | ) |
\ SO__NODE_ABSTRACT_METHODS(className) \ \ void * \ className::createInstance(SoType *) \ { \ return (void *)(new className); \ }
#define SO_NODE_ABSTRACT_HEADER | ( | className | ) |
public: \ \ static SoType getClassTypeId() \ { return classTypeId; } \ \ virtual SoType getTypeId() const; \ private: \ virtual SbBool getIsBuiltIn() const ; \ virtual const SoFieldData *getFieldData() const; \ private: \ static const SoFieldData **getFieldDataPtr(); \ private: \ static SbThreadMutex classMutex; \ static SoType classTypeId; /* Type id */ \ static SbBool isBuiltIn; \ static SbBool firstInstance; /* true until 2nd c'tor call */ \ static SoFieldData *fieldData; \ static const SoFieldData **parentFieldData
#define SO_NODE_ABSTRACT_SOURCE | ( | className | ) |
#define SO_NODE_ADD_EVENTIN | ( | fieldName | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::EVENTIN_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_EVENTOUT | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::EVENTOUT_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_EXPOSEDFIELD | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::EXPOSED_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_FIELD | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::EXPOSED_FIELD); \ CHECK_FIELD_INIT(fieldName); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_FIELD_EVENTIN | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::FIELD_EVENTIN_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_HIDDEN_FIELD | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::INTERNAL_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_MFIELD | ( | fieldName | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::EXPOSED_FIELD); \ CHECK_MFIELD_INIT(fieldName); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_NAMED_FIELD | ( | fieldName, | |||
memberName, | |||||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->memberName); \ this->memberName.setValue defValue; \ this->memberName.setContainer(this); \ this->memberName.setFieldType(SoField::EXPOSED_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_PRIVATEFIELD | ( | fieldName, | |||
defValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), &this->fieldName); \ this->fieldName.setValue defValue; \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::HIDDEN_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_ADD_PRIVATEMFIELD | ( | fieldName | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addField(this, SO__QUOTE(fieldName), \ &this->fieldName); \ this->fieldName.setContainer(this); \ this->fieldName.setFieldType(SoField::HIDDEN_FIELD); \ classMutex.unlock(); \ }
#define SO_NODE_CONSTRUCTOR | ( | className | ) |
SoBaseInitializer sbi(this); \ classMutex.lock(); \ SO__NODE_CHECK_INIT(className); \ if (fieldData == NULL) \ fieldData = new SoFieldData(parentFieldData ? \ (SoFieldData *)*parentFieldData : \ (SoFieldData *)NULL); \ else \ firstInstance = FALSE; \ classMutex.unlock()
This is included at the beginning of a constructor, to do required initializations.
#define SO_NODE_DEFINE_ENUM_VALUE | ( | enumType, | |||
enumValue | ) |
{ \ classMutex.lock(); \ SO__NODE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ fieldData->addEnumValue(SO__QUOTE(enumType), \ SO__QUOTE(enumValue), \ enumValue); \ classMutex.unlock(); \ }
#define SO_NODE_HEADER | ( | className | ) |
SO_NODE_ABSTRACT_HEADER(className); \ static void *createInstance(SoType* dynamicType = NULL)
Returns the type identifier for this class.
Returns the type identifier for this specific instance.
#define SO_NODE_INIT_ABSTRACT_CLASS | ( | className, | |||
parentClass, | |||||
parentPrintClass | ) |
\ SO_NODE_INIT_ABSTRACT_CLASS_INTERNAL(className,parentClass,parentPrintClass)
#define SO_NODE_INIT_ABSTRACT_CLASS_INTERNAL | ( | className, | |||
parentClass, | |||||
parentPrintClass | ) |
classMutex.lock(); \ SO_NODE_INIT_CLASS_CHECK_PARENT(className, parentClass); \ classTypeId = SoType::createType( SoType::fromName(parentPrintClass), \ SO__QUOTE(className), \ NULL, \ (short)SoNode::getNextActionMethodIndex()); \ if (parentFieldData == NULL) \ SoNode::incNextActionMethodIndex(); \ parentFieldData = parentClass::getFieldDataPtr(); \ classMutex.unlock();
#define SO_NODE_INIT_CLASS | ( | className, | |||
parentClass, | |||||
parentPrintClass | ) |
\ SO_NODE_INIT_CLASS_INTERNAL(className,parentClass,parentPrintClass)
#define SO_NODE_INIT_CLASS_CHECK_PARENT | ( | className, | |||
parentClass | ) |
if (parentClass::getClassTypeId().isBad()) \ parentClass::initClass()
#define SO_NODE_INIT_CLASS_INTERNAL | ( | className, | |||
parentClass, | |||||
parentPrintClass | ) |
classMutex.lock(); \ SO_NODE_INIT_CLASS_CHECK_PARENT(className, parentClass); \ classTypeId = SoType::createType( SoType::fromName(parentPrintClass), \ SO__QUOTE(className), \ &className::createInstance, \ (short)SoNode::getNextActionMethodIndex()); \ if (parentFieldData == NULL) \ SoNode::incNextActionMethodIndex(); \ parentFieldData = parentClass::getFieldDataPtr(); \ classMutex.unlock();
#define SO_NODE_IS_FIRST_INSTANCE | ( | ) |
\ (firstInstance == TRUE)
Boolean check that can be used in constructors.
#define SO_NODE_SOURCE | ( | className | ) |
#define SO_THREAD_NODE_EXIT_CLASS | ( | className | ) |
#define SO_THREAD_NODE_INIT_CLASS | ( | className, | |||
structName | ) |
\ SB_THREAD_INIT_CLASS(className,structName)