Open Inventor Reference
SoSubField.h File Reference

Go to the source code of this file.

Macros

#define SO__FIELD_HEADER(className)
 ===========================================================================
 
#define SO__SFIELD_RW_HEADER(className)
 
#define SO__MFIELD_RW_HEADER(className)
 
#define SO__FIELD_INIT_CLASS(className, classPrintName, parentClass)
 
#define SO__FIELD_ID_SOURCE(className)
 
#define SO__FIELD_EQ_SAME_SOURCE(className)
 
#define SO_SFIELD_REQUIRED_HEADER(className)    SO__FIELD_HEADER(className)
 ===========================================================================
 
#define SO_SFIELD_CONSTRUCTOR_HEADER(className)
 This declares a constructor and destructor for a single-value field class.
 
#define SO_SFIELD_VALUE_HEADER(className, valueType, valueRef)
 This declares value processing methods and variables for a single-value field class.
 
#define SO_SFIELD_DERIVED_VALUE_HEADER(className, valueType, valueRef)
 This is like the above macro, but can be used by a field class derived from another (non-abstract) field class.
 
#define SO_SFIELD_HEADER(className, valueType, valueRef)
 This macro is all that is needed for most single-value field classes.
 
#define SO_SFIELD_DERIVED_HEADER(className, valueType, valueRef)
 This macro is all that is needed for most single-value field classes that are derived from other field classes.
 
#define SO_MFIELD_REQUIRED_HEADER(className)    SO__FIELD_HEADER(className)
 ===========================================================================
 
#define SO_MFIELD_CONSTRUCTOR_HEADER(className)
 This declares a constructor and destructor for a multiple-value field class.
 
#define SO_MFIELD_VALUE_HEADER(className, valueType, valueRef)
 This declares value processing methods and variables for a multiple-value field class.
 
#define SO_MFIELD_DERIVED_VALUE_HEADER(className, valueType, valueRef)
 This is like the above macro, but can be used by a field class derived from another (non-abstract) field class.
 
#define SO_MFIELD_HEADER(className, valueType, valueRef)
 This macro is all that is needed for most multiple-value field classes.
 
#define SO_MFIELD_DERIVED_HEADER(className, valueType, valueRef)
 This macro is all that is needed for most multiple-value field classes that are derived from other field classes.
 
#define SO_SFIELD_INIT_CLASS(className, parentClass)    SO__FIELD_INIT_CLASS(className, SO__QUOTE(className), parentClass)
 ===========================================================================
 
#define SO_SFIELD_REQUIRED_SOURCE(className)
 This defines the variables and methods declared in SO_SFIELD_REQUIRED_HEADER().
 
#define SO_SFIELD_CONSTRUCTOR_SOURCE(className)
 This defines the constructor and destructor.
 
#define SO_SFIELD_VALUE_SOURCE(className, valueType, valueRef)
 This defines the variables and methods declared in SO_SFIELD_VALUE_HEADER().
 
#define SO_SFIELD_SOURCE(className, valueType, valueRef)
 This macro is all that is needed for most single-value field classes.
 
#define SO_SFIELD_DERIVED_SOURCE(className, valueType, valueRef)
 This macro is all that is needed for most single-value field classes that are derived from other field classes.
 
#define SO_MFIELD_INIT_CLASS(className, parentClass)    SO__FIELD_INIT_CLASS(className, SO__QUOTE(className), parentClass)
 ===========================================================================
 
#define SO_MFIELD_REQUIRED_SOURCE(className)
 This defines the variables and methods declared in SO_MFIELD_REQUIRED_HEADER().
 
#define SO_MFIELD_CONSTRUCTOR_SOURCE(className)
 This defines a constructor and destructor that work with the variables and methods defined in SO_MFIELD_VALUE_HEADER().
 
#define SO_MFIELD_DERIVED_CONSTRUCTOR_SOURCE(className)
 This defines an empty constructor and destructor for classes derived from other field classes, since they inherit value processing.
 
#define SO_MFIELD_VALUE_SOURCE(className, valueType, valueRef)
 This defines the variables and methods declared in SO_MFIELD_VALUE_HEADER().
 
#define SO_MFIELD_ALLOC_SOURCE(className, valueType)
 This allocates/reallocates room for values, using the "new" and "delete" operators, so the constructor and destructor are called for new and deleted values.
 
#define SO_MFIELD_MALLOC_SOURCE(className, valueType)
 This allocates/reallocates room for values, using malloc() and realloc().
 
#define SO_MFIELD_SOURCE(className, valueType, valueRef)
 This macro is all that is needed for most multiple-value field classes.
 
#define SO_MFIELD_SOURCE_MALLOC(className, valueType, valueRef)
 This is like the above macro, but uses the allocation macro that uses malloc() and realloc().
 
#define SO_MFIELD_DERIVED_SOURCE(className, valueType, valueRef)
 This macro is all that is needed for most multiple-value field classes that are derived from other field classes.
 

Macro Definition Documentation

◆ SO__FIELD_EQ_SAME_SOURCE

#define SO__FIELD_EQ_SAME_SOURCE (   className)
Value:
\
void \
className::copyFrom(const SoField &f) \
{ \
*this = * static_cast<const className *>(&f); \
} \
\
bool \
className::isSame(const SoField &f) const \
{ \
return (getTypeId() == f.getTypeId() && \
(*this) == static_cast<const className &>(f)); \
}
Base class for all fields.
Definition SoField.h:185

Definition at line 196 of file SoSubField.h.

◆ SO__FIELD_HEADER

#define SO__FIELD_HEADER (   className)
Value:
public: \
virtual SoType getTypeId() const; \
static SoType getClassTypeId() { return classTypeId; } \
\
/* Copy from another field of same type */ \
const className & operator =(const className &f); \
\
SoINTERNAL public: \
/* Copy from another field of unknown type (assumed to be same type) */ \
virtual void copyFrom(const SoField &f); \
\
static void * createInstance(); /* for SoType */ \
\
/* Returns TRUE if fields are same type and have same values */ \
virtual bool isSame(const SoField &f) const; \
\
private: \
static SoType classTypeId
#define SoINTERNAL
Definition SbBasic.h:155
SoType has no virtual functions to keep it small...
Definition SoType.h:103

These are all internal macros used by some of the public ones.


Definition at line 140 of file SoSubField.h.

◆ SO__FIELD_ID_SOURCE

#define SO__FIELD_ID_SOURCE (   className)
Value:
\
SoType className::classTypeId; \
\
SoType \
className::getTypeId() const \
{ \
return classTypeId; \
} \
void * \
className::createInstance() \
{ \
return static_cast<void *>(new className); \
}

Definition at line 181 of file SoSubField.h.

◆ SO__FIELD_INIT_CLASS

#define SO__FIELD_INIT_CLASS (   className,
  classPrintName,
  parentClass 
)
Value:
classTypeId = SoType::createType(parentClass::getClassTypeId(), \
classPrintName, \
&className::createInstance)
static SoType createType(SoType parent, SbName name, void *(*createMethod)()=NULL, short data=0)
Create a new type.

Definition at line 176 of file SoSubField.h.

◆ SO__MFIELD_RW_HEADER

#define SO__MFIELD_RW_HEADER (   className)
Value:
private: \
/* Reads indexed value of field from file */ \
virtual bool read1Value(SoInput *in, int index); \
\
/* Writes one (indexed) value to file */ \
virtual void write1Value(SoOutput *out, int index) const
Used to read Inventor data files.
Definition SoInput.h:128
Used to write Inventor data files.
Definition SoOutput.h:90

Definition at line 168 of file SoSubField.h.

◆ SO__SFIELD_RW_HEADER

#define SO__SFIELD_RW_HEADER (   className)
Value:
private: \
/* Reads value of field from file */ \
virtual bool readValue(SoInput *in); \
\
/* Writes value of field to file */ \
virtual void writeValue(SoOutput *out) const

Definition at line 160 of file SoSubField.h.

◆ SO_MFIELD_ALLOC_SOURCE

#define SO_MFIELD_ALLOC_SOURCE (   className,
  valueType 
)
Value:
void \
className::allocValues(int newNum) \
{ \
if (values == NULL) { \
if (newNum > 0) \
values = new valueType[newNum]; \
} \
else { \
valueType *oldValues = values; \
int i; \
\
if (newNum > 0) { \
values = new valueType[newNum]; \
for (i = 0; i < num && i < newNum; i++) \
values[i] = oldValues[i]; \
} \
else \
values = NULL; \
delete [] oldValues; \
} \
\
num = maxNum = newNum; \
}

Definition at line 702 of file SoSubField.h.

◆ SO_MFIELD_CONSTRUCTOR_HEADER

#define SO_MFIELD_CONSTRUCTOR_HEADER (   className)
Value:
public: \
className(); \
virtual ~className()

Definition at line 327 of file SoSubField.h.

◆ SO_MFIELD_CONSTRUCTOR_SOURCE

#define SO_MFIELD_CONSTRUCTOR_SOURCE (   className)
Value:
\
className::className() \
{ \
values = NULL; \
} \
\
className::~className() \
{ \
deleteAllValues(); \
}

If you define your own value processing differently, you may not be able to use these.

Definition at line 578 of file SoSubField.h.

◆ SO_MFIELD_DERIVED_CONSTRUCTOR_SOURCE

#define SO_MFIELD_DERIVED_CONSTRUCTOR_SOURCE (   className)
Value:
\
className::className() \
{ \
} \
\
className::~className() \
{ \
}

Definition at line 598 of file SoSubField.h.

◆ SO_MFIELD_DERIVED_HEADER

#define SO_MFIELD_DERIVED_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO_MFIELD_CONSTRUCTOR_HEADER(className); \
SO_MFIELD_DERIVED_VALUE_HEADER(className, valueType, valueRef)
#define SO_MFIELD_REQUIRED_HEADER(className)
===========================================================================
Definition SoSubField.h:318

It includes the relevant macros.

Definition at line 429 of file SoSubField.h.

◆ SO_MFIELD_DERIVED_SOURCE

#define SO_MFIELD_DERIVED_SOURCE (   className,
  valueType,
  valueRef 
)
Value:
SO_MFIELD_DERIVED_CONSTRUCTOR_SOURCE(className)
#define SO_MFIELD_REQUIRED_SOURCE(className)
This defines the variables and methods declared in SO_MFIELD_REQUIRED_HEADER().
Definition SoSubField.h:555

It includes the relevant macros.

Definition at line 792 of file SoSubField.h.

◆ SO_MFIELD_DERIVED_VALUE_HEADER

#define SO_MFIELD_DERIVED_VALUE_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO__MFIELD_RW_HEADER(className); \
public: \
/* Since = operator is not inherited, we redefine it here */ \
valueRef operator =(valueRef newValue) \
{ setValue(newValue); return newValue; }
#define SO__MFIELD_RW_HEADER(className)
Definition SoSubField.h:168

It will inherit most of the field processing stuff.

Definition at line 402 of file SoSubField.h.

◆ SO_MFIELD_HEADER

#define SO_MFIELD_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO_MFIELD_CONSTRUCTOR_HEADER(className); \
SO_MFIELD_VALUE_HEADER(className, valueType, valueRef)

It includes the relevant macros.

Definition at line 416 of file SoSubField.h.

◆ SO_MFIELD_INIT_CLASS

#define SO_MFIELD_INIT_CLASS (   className,
  parentClass 
)     SO__FIELD_INIT_CLASS(className, SO__QUOTE(className), parentClass)

Macros to be called within the source file for a multiple-value field subclass:


This initializes type identifer variables. It should be called from within initClass().

Definition at line 545 of file SoSubField.h.

◆ SO_MFIELD_MALLOC_SOURCE

#define SO_MFIELD_MALLOC_SOURCE (   className,
  valueType 
)
Value:
void \
className::allocValues(int newNum) \
{ \
if (values == NULL) { \
if (newNum > 0) \
values = static_cast<valueType *>(malloc(sizeof(valueType) * newNum));\
} \
else { \
if (newNum > 0) \
values = static_cast<valueType *>(realloc(values, sizeof(valueType)*newNum));\
else { \
free(values); \
values = NULL; \
} \
} \
\
num = maxNum = newNum; \
}

This means that constructors and destructors will NOT be called for values. Therefore, this macro should not be used for any value types that have constructors or destructors! (It is used for fields that have simple types, like shorts and floats.)

Definition at line 737 of file SoSubField.h.

◆ SO_MFIELD_REQUIRED_HEADER

#define SO_MFIELD_REQUIRED_HEADER (   className)     SO__FIELD_HEADER(className)

Macros to be called within the class definition header for a multiple-value field subclass:


This declares all header info required for a multiple-value field class.

Definition at line 318 of file SoSubField.h.

◆ SO_MFIELD_REQUIRED_SOURCE

#define SO_MFIELD_REQUIRED_SOURCE (   className)
Value:
\
SO__FIELD_ID_SOURCE(className); \
SO__FIELD_EQ_SAME_SOURCE(className) \
\
const className & \
className::operator =(const className &f) \
{ \
if (f.getNum() < getNum()) \
deleteAllValues(); \
setValues(0, f.getNum(), f.getValues(0)); \
return *this; \
}

Definition at line 555 of file SoSubField.h.

◆ SO_MFIELD_SOURCE

#define SO_MFIELD_SOURCE (   className,
  valueType,
  valueRef 
)
Value:
SO_MFIELD_CONSTRUCTOR_SOURCE(className) \
SO_MFIELD_VALUE_SOURCE(className, valueType, valueRef) \
SO_MFIELD_ALLOC_SOURCE(className, valueType)

It includes the relevant macros, including the allocation macro that uses new and delete.

Definition at line 765 of file SoSubField.h.

◆ SO_MFIELD_SOURCE_MALLOC

#define SO_MFIELD_SOURCE_MALLOC (   className,
  valueType,
  valueRef 
)
Value:
SO_MFIELD_CONSTRUCTOR_SOURCE(className) \
SO_MFIELD_VALUE_SOURCE(className, valueType, valueRef) \
SO_MFIELD_MALLOC_SOURCE(className, valueType)

Definition at line 778 of file SoSubField.h.

◆ SO_MFIELD_VALUE_HEADER

#define SO_MFIELD_VALUE_HEADER (   className,
  valueType,
  valueRef 
)

Definition at line 339 of file SoSubField.h.

◆ SO_MFIELD_VALUE_SOURCE

#define SO_MFIELD_VALUE_SOURCE (   className,
  valueType,
  valueRef 
)

Definition at line 615 of file SoSubField.h.

◆ SO_SFIELD_CONSTRUCTOR_HEADER

#define SO_SFIELD_CONSTRUCTOR_HEADER (   className)
Value:
public: \
className(); \
virtual ~className()

Definition at line 233 of file SoSubField.h.

◆ SO_SFIELD_CONSTRUCTOR_SOURCE

#define SO_SFIELD_CONSTRUCTOR_SOURCE (   className)
Value:
\
className::className() \
{ \
} \
className::~className() \
{ \
}

Definition at line 476 of file SoSubField.h.

◆ SO_SFIELD_DERIVED_HEADER

#define SO_SFIELD_DERIVED_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO_SFIELD_CONSTRUCTOR_HEADER(className); \
SO_SFIELD_DERIVED_VALUE_HEADER(className, valueType, valueRef)
#define SO_SFIELD_REQUIRED_HEADER(className)
===========================================================================
Definition SoSubField.h:224

It includes the relevant macros.

Definition at line 300 of file SoSubField.h.

◆ SO_SFIELD_DERIVED_SOURCE

#define SO_SFIELD_DERIVED_SOURCE (   className,
  valueType,
  valueRef 
)
Value:
SO_SFIELD_CONSTRUCTOR_SOURCE(className)
#define SO_SFIELD_REQUIRED_SOURCE(className)
This defines the variables and methods declared in SO_SFIELD_REQUIRED_HEADER().
Definition SoSubField.h:458

It includes the relevant macros.

Definition at line 527 of file SoSubField.h.

◆ SO_SFIELD_DERIVED_VALUE_HEADER

#define SO_SFIELD_DERIVED_VALUE_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO__SFIELD_RW_HEADER(className); \
public: \
/* Since = operator is not inherited, we redefine it here */ \
valueRef operator =(valueRef newValue) \
{ setValue(newValue); return value; }
#define SO__SFIELD_RW_HEADER(className)
Definition SoSubField.h:160

It will inherit most of the field processing stuff.

Definition at line 273 of file SoSubField.h.

◆ SO_SFIELD_HEADER

#define SO_SFIELD_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO_SFIELD_CONSTRUCTOR_HEADER(className); \
SO_SFIELD_VALUE_HEADER(className, valueType, valueRef)

It includes the relevant macros.

Definition at line 287 of file SoSubField.h.

◆ SO_SFIELD_INIT_CLASS

#define SO_SFIELD_INIT_CLASS (   className,
  parentClass 
)     SO__FIELD_INIT_CLASS(className, SO__QUOTE(className), parentClass)

Macros to be called within the source file for a single-value field subclass:


This initializes type identifer variables. It should be called from within initClass().

Definition at line 448 of file SoSubField.h.

◆ SO_SFIELD_REQUIRED_HEADER

#define SO_SFIELD_REQUIRED_HEADER (   className)     SO__FIELD_HEADER(className)

Macros to be called within the class definition header for a single-value field subclass:


This declares all header info required for a single-value field class.

Definition at line 224 of file SoSubField.h.

◆ SO_SFIELD_REQUIRED_SOURCE

#define SO_SFIELD_REQUIRED_SOURCE (   className)
Value:
\
SO__FIELD_ID_SOURCE(className); \
SO__FIELD_EQ_SAME_SOURCE(className) \
\
const className & \
className::operator =(const className &f) \
{ \
setValue(f.getValue()); \
return *this; \
}

Definition at line 458 of file SoSubField.h.

◆ SO_SFIELD_SOURCE

#define SO_SFIELD_SOURCE (   className,
  valueType,
  valueRef 
)
Value:
SO_SFIELD_CONSTRUCTOR_SOURCE(className); \
SO_SFIELD_VALUE_SOURCE(className, valueType, valueRef)

It includes the relevant macros.

Definition at line 514 of file SoSubField.h.

◆ SO_SFIELD_VALUE_HEADER

#define SO_SFIELD_VALUE_HEADER (   className,
  valueType,
  valueRef 
)
Value:
SO__SFIELD_RW_HEADER(className); \
public: \
/* Get the value */ \
valueRef getValue() const \
{ evaluate(); return value; } \
\
/* Set value from a value of the appropriate type */ \
void setValue(valueRef newValue); \
valueRef operator =(valueRef newValue) \
{ setValue(newValue); return value; } \
\
/* Equality/inequality test for fields of same type */ \
bool operator ==(const className &f) const; \
bool operator !=(const className &f) const \
{ return ! ((*this) == f); } \
\
protected: \
valueType value
INVENTOR_API bool operator!=(const SbBox3f &b1, const SbBox3f &b2)
Definition SbBox.h:207
INVENTOR_API bool operator==(const SbBox3f &b1, const SbBox3f &b2)

Definition at line 245 of file SoSubField.h.

◆ SO_SFIELD_VALUE_SOURCE

#define SO_SFIELD_VALUE_SOURCE (   className,
  valueType,
  valueRef 
)
Value:
\
void \
className::setValue(valueRef newValue) \
{ \
value = newValue; \
valueChanged(); \
} \
\
bool \
className::operator ==(const className &f) const \
{ \
return getValue() == f.getValue(); \
}

Definition at line 492 of file SoSubField.h.