Open Inventor Reference
|
SoType has no virtual functions to keep it small... More...
#include <Inventor/SoType.h>
Public Member Functions | |
SbName | getName () const |
Returns the name associated with a type. More... | |
SoType | getParent () const |
Returns the type of the parent class. More... | |
bool | isBad () const |
Returns TRUE if the type is a bad type. More... | |
bool | isDerivedFrom (SoType t) const |
Returns TRUE if the type is derived from type t . More... | |
bool | canCreateInstance () const |
Some types are able to create instances; for example, most nodes and engines (those which are not abstract classes) can be created this way. More... | |
void * | createInstance () const |
Creates and returns a pointer to an instance of the type. More... | |
bool | operator== (const SoType t) const |
Returns TRUE if this type is the same as or not the same as the given type. More... | |
bool | operator!= (const SoType t) const |
Returns TRUE if this type is the same as or not the same as the given type. More... | |
bool | operator< (const SoType t) const |
Less-than comparison operator that can be used to sort types. More... | |
short | getData () const |
Get data. More... | |
short | getKey () const |
Returns the type key as a short. More... | |
void | makeInternal () |
Mark this type as internal; if internal, getAllDerivedFrom and fromName will not return the type. More... | |
Static Public Member Functions | |
static SoType | fromName (SbName name) |
Returns the type associated with the given name. More... | |
static SoType | badType () |
Returns an always-illegal type. Useful for returning errors. More... | |
static int | getAllDerivedFrom (SoType type, SoTypeList &list) |
Adds all types derived from the given type to the given type list. More... | |
static SoType | createType (SoType parent, SbName name, void *(*createMethod)()=NULL, short data=0) |
Create a new type. More... | |
static SoType | overrideType (SoType existingType, void *(*createMethod)()=NULL) |
Make an new type act like an existing type. More... | |
static void | init () |
Initialize the type system. More... | |
static int | getNumTypes () |
Get the number of types currently registed in the types dictionary. More... | |
Stores runtime type information.
The SoType class keeps track of runtime type information in Inventor. Each type is associated with a given name, so lookup is possible in either direction.
Many Inventor classes request a unique SoType when they are initialized. This type can then be used to find out the actual class of an instance when only its base class is known, or to obtain an instance of a particular class given its type or name.
Note that the names associated with types of Inventor classes do not contain the "So" prefix.
|
static |
bool SoType::canCreateInstance | ( | ) | const |
This method returns TRUE if the type supports such creation.
void* SoType::createInstance | ( | ) | const |
Returns NULL if an instance could not be created for some reason. The pointer is returned as a generic pointer, but can be cast to the appropriate type. For example:
is a convoluted way of creating a new instance of an SoCube.
|
static |
|
static |
Returns the number of types added.
|
inline |
Definition at line 177 of file SoType.h.
Referenced by SoNode::getActionMethodIndex().
SbName SoType::getName | ( | ) | const |
|
inlinestatic |
SoType SoType::getParent | ( | ) | const |
|
static |
bool SoType::isDerivedFrom | ( | SoType | t | ) | const |
void SoType::makeInternal | ( | ) |
|
inline |
|
inline |
|
inline |
unsigned int SoType::index |
Definition at line 195 of file SoType.h.
Referenced by operator!=(), operator<(), and operator==().