Open Inventor Reference
|
#include <Inventor/engines/SoEngine.h>
#include <Inventor/engines/SoOutputData.h>
#include <Inventor/errors/SoDebugError.h>
#include <Inventor/fields/SoFieldData.h>
Go to the source code of this file.
Defines | |
#define | SO__ENGINE_CHECK_INIT(className) { int _value_false= 0; while(_value_false) {} } |
Debugging macros called by other macros in this file. | |
#define | SO__ENGINE_CHECK_CONSTRUCT(where) { int _value_false= 0; while(_value_false) {} } |
#define | SO_ENGINE_ABSTRACT_HEADER(className) |
Macros to be called within the class definition header: | |
#define | SO_ENGINE_HEADER(className) |
#define | SO__ENGINE_ABSTRACT_VARS(className) |
This declares the static variables defined in SO_ENGINE_HEADER. | |
#define | SO__ENGINE_VARS(className) SO__ENGINE_ABSTRACT_VARS(className) |
#define | SO__ENGINE_ABSTRACT_METHODS(className) |
These implement the methods defined in SO_ENGINE_HEADER. | |
#define | SO__ENGINE_METHODS(className) |
#define | SO_ENGINE_SOURCE(className) |
Macros to be called within the source file for a engine subclass: | |
#define | SO_ENGINE_ABSTRACT_SOURCE(className) |
#define | SO__ENGINE_INIT_CLASS(className, classPrintName, parentClass) |
Internal initialization macros. | |
#define | SO__ENGINE_INIT_ABSTRACT_CLASS(className, classPrintName, parent) |
#define | SO_ENGINE_INIT_CLASS(className, parentClass, parentPrintClass) |
This initializes the type identifer variables This macro should be called from within initClass(). | |
#define | SO_ENGINE_INIT_ABSTRACT_CLASS(className, parent, parentPrintClass) |
#define | SO_ENGINE_CONSTRUCTOR(className) |
Macro to be called within each constructor. | |
#define | SO_ENGINE_IS_FIRST_INSTANCE() (firstInstance == TRUE) |
This is a boolean value that can be tested in constructors. | |
#define | SO_ENGINE_ADD_INPUT(inputName, defValue) |
This adds the info for an input to the SoFieldData and sets the default value for it. | |
#define | SO_ENGINE_ADD_OUTPUT(outputName, type) |
This adds the info for an output to the SoEngineOutputData. | |
#define | SO_ENGINE_DEFINE_ENUM_VALUE(enumType, enumValue) |
This registers a value of an enum type. | |
#define | SO_ENGINE_OUTPUT(outputName, type, code) |
This takes care of writing the value to all connected outputs. |
#define SO__ENGINE_ABSTRACT_METHODS | ( | className | ) |
\ SoType \ className::getTypeId() const \ { \ return classTypeId; \ } \ \ const SoFieldData * \ className::getFieldData() const \ { \ return inputData; \ } \ \ const SoEngineOutputData * \ className::getOutputData() const \ { \ return outputData; \ }
Definition at line 197 of file SoSubEngine.h.
#define SO__ENGINE_ABSTRACT_VARS | ( | className | ) |
SoType className::classTypeId; \ SbBool className::firstInstance=TRUE; \ SoEngineOutputData *className::outputData; \ SoFieldData * className::inputData; \ const SoEngineOutputData **className::parentOutputData; \ const SoFieldData ** className::parentInputData
Definition at line 181 of file SoSubEngine.h.
#define SO__ENGINE_CHECK_CONSTRUCT | ( | where | ) | { int _value_false= 0; while(_value_false) {} } |
Definition at line 135 of file SoSubEngine.h.
#define SO__ENGINE_CHECK_INIT | ( | className | ) | { int _value_false= 0; while(_value_false) {} } |
Definition at line 134 of file SoSubEngine.h.
#define SO__ENGINE_INIT_ABSTRACT_CLASS | ( | className, | |
classPrintName, | |||
parent | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = SoType::createType(parent::getClassTypeId(), \ classPrintName); \ parentInputData = parent::getInputDataPtr(); \ parentOutputData = parent::getOutputDataPtr(); \ } while (_value_false); \ }
Definition at line 257 of file SoSubEngine.h.
#define SO__ENGINE_INIT_CLASS | ( | className, | |
classPrintName, | |||
parentClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(parentClass::getClassTypeId(), \ classPrintName, \ &className::createInstance); \ parentInputData = parentClass::getInputDataPtr(); \ parentOutputData = parentClass::getOutputDataPtr(); \ } while (_value_false); \ }
Definition at line 245 of file SoSubEngine.h.
#define SO__ENGINE_METHODS | ( | className | ) |
\ SO__ENGINE_ABSTRACT_METHODS(className) \ \ void * \ className::createInstance() \ { \ return (void *)(new className); \ }
Definition at line 217 of file SoSubEngine.h.
#define SO__ENGINE_VARS | ( | className | ) | SO__ENGINE_ABSTRACT_VARS(className) |
Definition at line 189 of file SoSubEngine.h.
#define SO_ENGINE_ABSTRACT_HEADER | ( | className | ) |
public: \ static SoType getClassTypeId() { return classTypeId; } \ virtual SoType getTypeId() const; /* Returns type id */ \ public: \ virtual const SoFieldData * getFieldData() const; \ virtual const SoEngineOutputData * getOutputData() const; \ protected: \ static const SoFieldData ** getInputDataPtr() \ { return (const SoFieldData **)&inputData; } \ static const SoEngineOutputData ** getOutputDataPtr() \ { return (const SoEngineOutputData **)&outputData; } \ private: \ static SoType classTypeId; /* Type id */ \ static SbBool firstInstance; /* True for first ctor call */ \ static SoFieldData *inputData; /* Info on input fields */ \ static SoEngineOutputData *outputData; /* Info on outputs */ \ static const SoFieldData **parentInputData; /* parent's fields */ \ static const SoEngineOutputData **parentOutputData
These defines type-identifier and naming variables and methods that all engines and abstract engines must support
Definition at line 149 of file SoSubEngine.h.
#define SO_ENGINE_ABSTRACT_SOURCE | ( | className | ) |
SO__ENGINE_ABSTRACT_VARS(className); \ SO__ENGINE_ABSTRACT_METHODS(className)
Definition at line 236 of file SoSubEngine.h.
#define SO_ENGINE_ADD_INPUT | ( | inputName, | |
defValue | |||
) |
{ \ int _value_false= 0; \ do { \ SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ inputData->addField(this, SO__QUOTE(inputName), \ &this->inputName); \ this->inputName.setValue defValue; \ this->inputName.setContainer(this); \ } while (_value_false); \ }
The parameters are as follows: inputName: the name of the input (as a member) defValue: the default value enclosed in parentheses
For example,
SO_ENGINE_ADD_INPUT(vector1, (0, 0, 0)); SO_ENGINE_ADD_INPUT(triggerTime, (0.0));
adds info about inputs named vector1 and triggerTime with the given default values. The inputs must be public member variables of a type derived from SoField.
Definition at line 342 of file SoSubEngine.h.
#define SO_ENGINE_ADD_OUTPUT | ( | outputName, | |
type | |||
) |
{ \ int _value_false= 0; \ do { \ SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ outputData->addOutput(this, SO__QUOTE(outputName), \ &this->outputName, \ type::getClassTypeId()); \ this->outputName.setContainer(this); \ } while (_value_false); \ }
The parameters are as follows: fieldName: the name of the output (as a member) type: the type of the output (name of SoField subclass)
For example,
SO_ENGINE_ADD_OUTPUT(result, SoSFVec3f); SO_ENGINE_ADD_OUTPUT(hour, SoSFInt32);
adds info about outputs named result and int32_t that can be hooked up to fields of the given type. The outputs must be public member variables of type SoEngineOutput.
Definition at line 371 of file SoSubEngine.h.
#define SO_ENGINE_CONSTRUCTOR | ( | className | ) |
{ \ int _value_false= 0; \ do { \ SO__ENGINE_CHECK_INIT(className); \ if (inputData == NULL) { \ inputData = new SoFieldData(parentInputData ? \ *parentInputData : NULL); \ outputData = new SoEngineOutputData(parentOutputData ? \ *parentOutputData : NULL); \ } \ else \ firstInstance = FALSE; \ isBuiltIn = FALSE; \ } while (_value_false); \ }
Definition at line 301 of file SoSubEngine.h.
#define SO_ENGINE_DEFINE_ENUM_VALUE | ( | enumType, | |
enumValue | |||
) |
{ \ int _value_false= 0; \ do { \ SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \ if (firstInstance) \ inputData->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 engine defines an enum, each of the enum's values should be registered using this macro. For example:
[ in MyFunc.h file: ] class MyFunc { ... enum Chipmunk { ALVIN, SIMON, THEODORE }; ... }
[ in constructor MyFunc::MyFunc(): ] SO_ENGINE_DEFINE_ENUM_VALUE(Chipmunk, ALVIN); SO_ENGINE_DEFINE_ENUM_VALUE(Chipmunk, SIMON); SO_ENGINE_DEFINE_ENUM_VALUE(Chipmunk, THEODORE);
Definition at line 405 of file SoSubEngine.h.
#define SO_ENGINE_HEADER | ( | className | ) |
\ SO_ENGINE_ABSTRACT_HEADER(className); \ \ private: \ static void *createInstance()
Definition at line 169 of file SoSubEngine.h.
#define SO_ENGINE_INIT_ABSTRACT_CLASS | ( | className, | |
parent, | |||
parentPrintClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = SoType::createType(SoType::fromName(parentPrintClass), \ SO__QUOTE(className)); \ parentInputData = parent::getInputDataPtr(); \ parentOutputData = parent::getOutputDataPtr(); \ } while (_value_false); \ }
Definition at line 286 of file SoSubEngine.h.
#define SO_ENGINE_INIT_CLASS | ( | className, | |
parentClass, | |||
parentPrintClass | |||
) |
{ \ int _value_false= 0; \ do { \ classTypeId = \ SoType::createType(SoType::fromName(parentPrintClass), \ SO__QUOTE(className), \ &className::createInstance); \ parentInputData = parentClass::getInputDataPtr(); \ parentOutputData = parentClass::getOutputDataPtr(); \ } while (_value_false); \ }
The parentClass argument should be the class that this subclass is derived from.
Definition at line 274 of file SoSubEngine.h.
#define SO_ENGINE_IS_FIRST_INSTANCE | ( | ) | (firstInstance == TRUE) |
Definition at line 323 of file SoSubEngine.h.
#define SO_ENGINE_OUTPUT | ( | outputName, | |
type, | |||
code | |||
) |
{ \ int _value_false= 0; \ do { \ if (outputName.isEnabled()) { \ for (int _eng_out_i = 0; \ _eng_out_i < outputName.getNumConnections(); \ _eng_out_i++) { \ type *_eng_out_temp = (type *) outputName[_eng_out_i]; \ if (!_eng_out_temp->isReadOnly()) { \ _eng_out_temp->code; \ } \ } \ } \ } while (_value_false); \ }
This should be called in the evaluate() routine.
Definition at line 421 of file SoSubEngine.h.
#define SO_ENGINE_SOURCE | ( | className | ) |
SO__ENGINE_VARS(className); \ SO__ENGINE_METHODS(className)
Definition at line 232 of file SoSubEngine.h.