Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/database/include/Inventor/misc/upgraders/SoUpgrader.h File Reference

Go to the source code of this file.

Classes

class  SoUpgrader

Defines

#define SO_UPGRADER_INIT_CLASS(className)   SO__NODE_INIT_CLASS(className, SO__QUOTE(className), SoUpgrader)
 Macro to initialize upgrader classes.
#define SO_REGISTER_UPGRADER(oldClassName, version)
 Macro to register a converter.
#define SO_UPGRADER_COPY_FIELD2(oldName, newName, nodeVar)
 Shorthand macro to copy a field value (and flags) from an upgrader instance into a real node.
#define SO_UPGRADER_COPY_FIELD(fieldName, nodeVar)   SO_UPGRADER_COPY_FIELD2(fieldName, fieldName, nodeVar)
#define SO_UPGRADER_CREATE_NEW(className)   ((className *) className::getClassTypeId().createInstance())
 Use this macro instead of calling "new" on the className.

Define Documentation

#define SO_REGISTER_UPGRADER (   oldClassName,
  version 
)
Value:
do {                                                                  \
            classTypeId.makeInternal();                                       \
            registerUpgrader(classTypeId, SO__QUOTE(oldClassName), version);  \
        } while (0)

This should be put in the initClass method just after SO_UPGRADER_INIT_CLASS. This also marks the upgrader class as internal (upgraders are transient, and should only exist while reading an old Inventor file-- you shouldn't be able to just create one using SoType::createInstance). Pass in the name of the class being upgraded (e.g. if this is MyV1Upgrader that upgrades the MyClass node, you would SO_REGISTER_UPGRADER(MyClass, 1.0)).

Definition at line 134 of file SoUpgrader.h.

#define SO_UPGRADER_COPY_FIELD (   fieldName,
  nodeVar 
)    SO_UPGRADER_COPY_FIELD2(fieldName, fieldName, nodeVar)

Definition at line 151 of file SoUpgrader.h.

#define SO_UPGRADER_COPY_FIELD2 (   oldName,
  newName,
  nodeVar 
)
Value:
do {                                                                  \
            if (! oldName.isDefault())                                        \
                nodeVar->newName = oldName;                                   \
            if (oldName.isIgnored())                                          \
                nodeVar->newName.setIgnored(TRUE);                            \
        } while (0)

The first version can be used if the fields have different names; the second assumes they're the same.

Definition at line 143 of file SoUpgrader.h.

#define SO_UPGRADER_CREATE_NEW (   className)    ((className *) className::getClassTypeId().createInstance())

This ensures that overridden types are created during an upgrade.

Definition at line 156 of file SoUpgrader.h.

#define SO_UPGRADER_INIT_CLASS (   className)    SO__NODE_INIT_CLASS(className, SO__QUOTE(className), SoUpgrader)

Pass in the name of the upgrader's class.

Definition at line 124 of file SoUpgrader.h.