#include <Inventor/errors/SoDebugError.h>
#include <Inventor/fields/SoFieldData.h>
#include <Inventor/threads/SbThreadLocalStorage.h>
#include <Inventor/threads/SbThreadMutex.h>
#include <Inventor/SbRenderEngineMode.h>
#include <Inventor/SoDB.h>
Go to the source code of this file.
#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; \ SbRenderEngineMode className::s_renderEngineMode;
#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_RENDERING_MODE(className, parentClass); \ 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; \ \
#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)
#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_RENDERING_MODE(className,parentClass); \ 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_RENDERING_MODE(className, parentClass); \ 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_INIT_RENDERING_MODE | ( | className, | |||
parentClass | ) |
if ( className::getClassRenderEngineMode().isNotDefined() ) \ { \ if (parentClass::getClassRenderEngineMode().isChildrenInherit()) \ s_renderEngineMode = parentClass::getClassRenderEngineMode(); \ else \ SbRenderEngineMode::postInitWarning( OIV_FUNCTION); \ }
#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)
static SbRenderEngineMode& getClassRenderEngineMode | ( | ) | [static] |
Returns the Render engine mode supported for this class.
virtual const SbRenderEngineMode& getRenderEngineMode | ( | ) | const [virtual] |
Returns the type identifier for this class.
Returns the type identifier for this specific instance. Returns the Render engine mode supported by this specific instance.
SbThreadMutex classMutex [static] |
SoType classTypeId [static] |
SoFieldData* fieldData [static] |
SbBool firstInstance [static] |
const SoFieldData** parentFieldData [static] |