SoType Class Reference
[General]

Stores runtime type information. More...

#include <Inventor/SoType.h>

List of all members.

Public Member Functions

SbName getName () const
SoType getParent () const
SbBool isBad () const
SbBool isDerivedFrom (const SoType &t) const
template<typename TypedObjectClass >
SbBool isDerivedFrom () const
SbBool canCreateInstance () const
void * createInstance (SoType *overrideType=NULL) const
bool operator== (const SoType t) const
bool operator!= (const SoType t) const
bool operator< (const SoType t) const

Static Public Member Functions

static SoType fromName (const SbName &name)
static SoType badType ()
static int getAllDerivedFrom (const SoType &type, SoTypeList &list)

Friends

std::ostream & operator<< (std::ostream &os, const SoType &t)

Detailed Description

Stores runtime type information.

The SoType class keeps track of runtime type information in Open Inventor. Each type is associated with a given name, so lookup is possible in either direction.

Many Open 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 Open Inventor classes do not contain the "So" prefix.

SEE ALSO

SoAction, SoBase, SoDetail, SoError, SoEvent, SoField


Member Function Documentation

static SoType SoType::badType (  )  [inline, static]

Returns an always-illegal type.

Useful for returning errors.

SbBool SoType::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.

This method returns TRUE if the type supports such creation.

void* SoType::createInstance ( SoType overrideType = NULL  )  const

Creates and returns a pointer to an instance of the type.

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 SoType SoType::fromName ( const SbName name  )  [static]

Returns the type associated with the given name.

static int SoType::getAllDerivedFrom ( const SoType type,
SoTypeList list 
) [static]

Adds all types derived from the given type to the given type list.

Returns the number of types added.

SbName SoType::getName (  )  const

Returns the name associated with a type.

SoType SoType::getParent (  )  const

Returns the type of the parent class.

SbBool SoType::isBad (  )  const

Returns TRUE if the type is a bad type.

template<typename TypedObjectClass >
SbBool SoType::isDerivedFrom (  )  const [inline]

Returns TRUE if the type is derived from the type of class TypedObjectClass.

Note: TypedObjectClass must be derived from SoTypedObject

SbBool SoType::isDerivedFrom ( const SoType t  )  const

Returns TRUE if the type is derived from type t.

bool SoType::operator!= ( const SoType  t  )  const

Returns TRUE if this type is not the same as the given type.

bool SoType::operator< ( const SoType  t  )  const

Less-than comparison operator that can be used to sort types.

This is pretty useless otherwise.

bool SoType::operator== ( const SoType  t  )  const

Returns TRUE if this type is the same as the given type.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SoType t 
) [friend]

Writes the SoType to the specified output stream.


Member Data Documentation

unsigned int SoType::data
unsigned int SoType::index
unsigned int SoType::intValue
unsigned int SoType::isPublic
struct { ... } SoType::storageStruct

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/