Open Inventor Reference
SoSubEngine.h File Reference

Go to the source code of this file.

Macros

#define SO__ENGINE_CHECK_INIT(className)
 Debugging macros called by other macros in this file.
 
#define SO__ENGINE_CHECK_CONSTRUCT(where)
 
#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.
 

Macro Definition Documentation

◆ SO__ENGINE_ABSTRACT_METHODS

#define SO__ENGINE_ABSTRACT_METHODS (   className)
Value:
\
SoType \
className::getTypeId() const \
{ \
return classTypeId; \
} \
\
const SoFieldData * \
className::getFieldData() const \
{ \
return inputData; \
} \
\
className::getOutputData() const \
{ \
return outputData; \
}
The SoEngineOutputData class holds data about engine outputs: the number of outputs the engine has,...
The SoFieldData class holds data about fields of an object: the number of fields the object has,...
Definition SoFieldData.h:88

Definition at line 194 of file SoSubEngine.h.

◆ SO__ENGINE_ABSTRACT_VARS

#define SO__ENGINE_ABSTRACT_VARS (   className)
Value:
SoType className::classTypeId; \
bool className::firstInstance=TRUE; \
SoEngineOutputData *className::outputData; \
SoFieldData * className::inputData; \
const SoEngineOutputData **className::parentOutputData; \
const SoFieldData ** className::parentInputData
#define TRUE
Definition SbBasic.h:76
SoType has no virtual functions to keep it small...
Definition SoType.h:103

Definition at line 178 of file SoSubEngine.h.

◆ SO__ENGINE_CHECK_CONSTRUCT

#define SO__ENGINE_CHECK_CONSTRUCT (   where)

Definition at line 132 of file SoSubEngine.h.

◆ SO__ENGINE_CHECK_INIT

#define SO__ENGINE_CHECK_INIT (   className)

Definition at line 131 of file SoSubEngine.h.

◆ SO__ENGINE_INIT_ABSTRACT_CLASS

#define SO__ENGINE_INIT_ABSTRACT_CLASS (   className,
  classPrintName,
  parent 
)
Value:
{ \
classTypeId = SoType::createType(parent::getClassTypeId(), \
classPrintName); \
parentInputData = parent::getInputDataPtr(); \
parentOutputData = parent::getOutputDataPtr(); \
}
static SoType createType(SoType parent, SbName name, void *(*createMethod)()=NULL, short data=0)
Create a new type.

Definition at line 251 of file SoSubEngine.h.

◆ SO__ENGINE_INIT_CLASS

#define SO__ENGINE_INIT_CLASS (   className,
  classPrintName,
  parentClass 
)
Value:
{ \
classTypeId = \
SoType::createType(parentClass::getClassTypeId(), \
classPrintName, \
&className::createInstance); \
parentInputData = parentClass::getInputDataPtr(); \
parentOutputData = parentClass::getOutputDataPtr(); \
}

Definition at line 242 of file SoSubEngine.h.

◆ SO__ENGINE_METHODS

#define SO__ENGINE_METHODS (   className)
Value:
\
SO__ENGINE_ABSTRACT_METHODS(className) \
\
void * \
className::createInstance() \
{ \
return (void *)(new className); \
}

Definition at line 214 of file SoSubEngine.h.

◆ SO__ENGINE_VARS

#define SO__ENGINE_VARS (   className)     SO__ENGINE_ABSTRACT_VARS(className)

Definition at line 186 of file SoSubEngine.h.

◆ SO_ENGINE_ABSTRACT_HEADER

#define SO_ENGINE_ABSTRACT_HEADER (   className)
Value:
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 bool 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 146 of file SoSubEngine.h.

◆ SO_ENGINE_ABSTRACT_SOURCE

#define SO_ENGINE_ABSTRACT_SOURCE (   className)
Value:
SO__ENGINE_ABSTRACT_METHODS(className)
#define SO__ENGINE_ABSTRACT_VARS(className)
This declares the static variables defined in SO_ENGINE_HEADER.

Definition at line 233 of file SoSubEngine.h.

◆ SO_ENGINE_ADD_INPUT

#define SO_ENGINE_ADD_INPUT (   inputName,
  defValue 
)
Value:
{ \
SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \
if (firstInstance) \
inputData->addField(this, SO__QUOTE(inputName), \
&this->inputName); \
this->inputName.setValue defValue; \
this->inputName.setContainer(this); \
}
#define SO__QUOTE(str)
Handy macros.
Definition SoBasic.h:69

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 324 of file SoSubEngine.h.

◆ SO_ENGINE_ADD_OUTPUT

#define SO_ENGINE_ADD_OUTPUT (   outputName,
  type 
)
Value:
{ \
SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \
if (firstInstance) \
outputData->addOutput(this, SO__QUOTE(outputName), \
&this->outputName, \
type::getClassTypeId()); \
this->outputName.setContainer(this); \
}

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 350 of file SoSubEngine.h.

◆ SO_ENGINE_CONSTRUCTOR

#define SO_ENGINE_CONSTRUCTOR (   className)
Value:
{ \
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; \
}
#define FALSE
Definition SbBasic.h:79

Definition at line 286 of file SoSubEngine.h.

◆ SO_ENGINE_DEFINE_ENUM_VALUE

#define SO_ENGINE_DEFINE_ENUM_VALUE (   enumType,
  enumValue 
)
Value:
{ \
SO__ENGINE_CHECK_CONSTRUCT(__FILE__); \
if (firstInstance) \
inputData->addEnumValue(SO__QUOTE(enumType), \
SO__QUOTE(enumValue), enumValue); \
}

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 381 of file SoSubEngine.h.

◆ SO_ENGINE_HEADER

#define SO_ENGINE_HEADER (   className)
Value:
\
SO_ENGINE_ABSTRACT_HEADER(className); \
\
private: \
static void *createInstance() /* Creates and returns instance */

Definition at line 166 of file SoSubEngine.h.

◆ SO_ENGINE_INIT_ABSTRACT_CLASS

#define SO_ENGINE_INIT_ABSTRACT_CLASS (   className,
  parent,
  parentPrintClass 
)
Value:
{ \
classTypeId = SoType::createType(SoType::fromName(parentPrintClass), \
SO__QUOTE(className)); \
parentInputData = parent::getInputDataPtr(); \
parentOutputData = parent::getOutputDataPtr(); \
}
static SoType fromName(SbName name)
Returns the type associated with the given name.

Definition at line 274 of file SoSubEngine.h.

◆ SO_ENGINE_INIT_CLASS

#define SO_ENGINE_INIT_CLASS (   className,
  parentClass,
  parentPrintClass 
)
Value:
{ \
classTypeId = \
SoType::createType(SoType::fromName(parentPrintClass), \
SO__QUOTE(className), \
&className::createInstance); \
parentInputData = parentClass::getInputDataPtr(); \
parentOutputData = parentClass::getOutputDataPtr(); \
}

The parentClass argument should be the class that this subclass is derived from.

Definition at line 265 of file SoSubEngine.h.

◆ SO_ENGINE_IS_FIRST_INSTANCE

#define SO_ENGINE_IS_FIRST_INSTANCE ( )    (firstInstance == TRUE)

Definition at line 305 of file SoSubEngine.h.

◆ SO_ENGINE_OUTPUT

#define SO_ENGINE_OUTPUT (   outputName,
  type,
  code 
)
Value:
{ \
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; \
} \
} \
} \
}

This should be called in the evaluate() routine.

Definition at line 394 of file SoSubEngine.h.

◆ SO_ENGINE_SOURCE

#define SO_ENGINE_SOURCE (   className)
Value:
SO__ENGINE_VARS(className); \
SO__ENGINE_METHODS(className)
#define SO__ENGINE_VARS(className)

Definition at line 229 of file SoSubEngine.h.