Open Inventor Reference
SoBase Class Reference

Base class for all nodes, paths, and engines. More...

#include <Inventor/misc/SoBase.h>

Inheritance diagram for SoBase:
SoFieldContainer SoPath SoEngine SoNode SoFullPath SoNodeKitPath SoBoolOperation SoCalculator SoComposeMatrix SoComposeRotation SoComposeRotationFromTo SoComposeVec2f SoComposeVec3f SoComposeVec4f SoComputeBoundingBox SoConcatenate SoCounter SoDecomposeMatrix SoDecomposeRotation SoDecomposeVec2f SoDecomposeVec3f SoDecomposeVec4f SoElapsedTime SoFieldConverter SoGate SoInterpolate SoOneShot SoOnOff SoSelectOne SoTimeCounter SoTransformVec3f SoTriggerAny SoUnknownEngine SoBaseColor SoBaseKit SoCallback SoCamera SoClipPlane SoColorIndex SoComplexity SoCoordinate3 SoCoordinate4 SoDrawStyle SoEnvironment SoEventCallback SoFile SoFont SoGroup SoInfo SoLabel SoLight SoLightModel SoMaterial SoMaterialBinding SoNodeKitListPart SoNormal SoNormalBinding SoPackedColor SoPickStyle SoPolygonOffset SoProfile SoProfileCoordinate2 SoProfileCoordinate3 SoShape SoShapeHints SoTexture2 SoTexture2Transform SoTextureCoordinate2 SoTextureCoordinateBinding SoTextureCoordinateFunction SoTransformation SoVertexProperty SoWWWInline SoTempPath

List of all members.

Public Member Functions

void ref () const
 Adds and removes a reference to an instance.
void unref () const
void unrefNoDelete () const
void touch ()
 Marks an instance as modified, simulating a change to it.
virtual SoType getTypeId () const =0
 Returns the type identifier for a specific instance.
SbBool isOfType (SoType type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
virtual SbName getName () const
 Returns the name of an instance.
virtual void setName (const SbName &name)
 Sets the name of an instance.
virtual void startNotify ()
 Initiates notification from an instance.
virtual void notify (SoNotList *list)
 Propagates modification notification through an instance.
void addAuditor (void *auditor, SoNotRec::Type type)
 Adds/removes an auditor to/from list.
void removeAuditor (void *auditor, SoNotRec::Type type)
const SoAuditorListgetAuditors ()
 Returns auditor list-- used by SoField and SoEngineOutput to trace forward connections.
int getRefCount () const
 Returns current reference count.
virtual void addWriteReference (SoOutput *out, SbBool isFromField=FALSE)
 Adds a reference to the instance when writing.
SbBool shouldWrite ()
 Returns TRUE if the instance should be written, based on the write-reference info already accumulated.

Static Public Member Functions

static SoType getClassTypeId ()
 Returns type identifier for this class.
static void initClass ()
 Setup type information.
static void incrementCurrentWriteCounter ()
 Increments the current write counter at the start of a write operation.
static void decrementCurrentWriteCounter ()
 Decrements the current write counter after a write operation, in some rare cases.
static void addName (SoBase *, const char *)
 Internal methods used to maintain the global name dictionary.
static void removeName (SoBase *, const char *)
static SoBasegetNamedBase (const SbName &, SoType)
 Helper routines used to get stuff out of nameDict.
static int getNamedBases (const SbName &, SoBaseList &, SoType)
static SbBool read (SoInput *in, SoBase *&base, SoType expectedType)
 Reads one instance of some subclass of SoBase.
static void setInstancePrefix (const SbString &c)
 This defaults to "+" and is used when naming nodes that are DEF's and USE'd.

Static Public Attributes

static SbBool traceRefs
 Turns on/off reference count tracing (for debugging)

Protected Types

enum  BaseFlags { IS_ENGINE = 1, IS_GROUP = 2 }
 This set of enums is used when reading and writing the base. More...

Protected Member Functions

 SoBase ()
 Constructor is protected - this is an abstract class.
virtual ~SoBase ()
 Virtual destructor so that subclasses are deleted properly.
virtual void destroy ()
 Actually deletes an instance.
SbBool hasMultipleWriteRefs () const
 Returns TRUE if the instance has multiple write references.
SbBool writeHeader (SoOutput *out, SbBool isGroup, SbBool isEngine) const
 Writes a header (name, open brace) or footer (close brace) to file defined by SoOutput.
void writeFooter (SoOutput *out) const
virtual const char * getFileFormatName () const
 Unknown nodes and engines write a different name for themselves than their typeId; this virtual method lets them do that (by default the typeId name is returned)
virtual SbBool readInstance (SoInput *in, unsigned short flags)=0
 Reads stuff into instance of subclass.

Static Protected Member Functions

static uint32_t getCurrentWriteCounter ()
 Returns current write counter.

Detailed Description

Abstract base class for Inventor node, path, and engine classes. This class handles reference counting, notification, and naming.

See Also
SoFieldContainer, SoNode, SoPath, SoEngine, SoDB

Definition at line 89 of file SoBase.h.


Member Enumeration Documentation

enum SoBase::BaseFlags [protected]

Each enum represents a different bit in a bit field which will be written.

Enumerator:
IS_ENGINE 
IS_GROUP 

Definition at line 198 of file SoBase.h.


Constructor & Destructor Documentation

SoBase::SoBase ( ) [protected]
virtual SoBase::~SoBase ( ) [protected, virtual]

Member Function Documentation

void SoBase::addAuditor ( void *  auditor,
SoNotRec::Type  type 
)
static void SoBase::addName ( SoBase ,
const char *   
) [static]
virtual void SoBase::addWriteReference ( SoOutput out,
SbBool  isFromField = FALSE 
) [virtual]

isFromField indicates whether the reference is from a field-to-field connection.

Reimplemented in SoFieldContainer, and SoBaseKit.

static void SoBase::decrementCurrentWriteCounter ( ) [inline, static]

Definition at line 220 of file SoBase.h.

virtual void SoBase::destroy ( ) [protected, virtual]

Allows subclasses to do other stuff before the deletion if necessary.

const SoAuditorList& SoBase::getAuditors ( ) [inline]

Definition at line 241 of file SoBase.h.

static SoType SoBase::getClassTypeId ( ) [inline, static]

Reimplemented in SoEngine, SoFieldContainer, SoNode, and SoPath.

Definition at line 127 of file SoBase.h.

static uint32_t SoBase::getCurrentWriteCounter ( ) [inline, static, protected]

Definition at line 173 of file SoBase.h.

virtual const char* SoBase::getFileFormatName ( ) const [protected, virtual]

Reimplemented in SoUnknownEngine, and SoUnknownNode.

virtual SbName SoBase::getName ( ) const [virtual]

If the instance has not been named, an empty SbName is returned. Objects that are named can be looked up using the getByName() methods of SoNode, SoEngine, or SoPath.

static SoBase* SoBase::getNamedBase ( const SbName ,
SoType   
) [static]
static int SoBase::getNamedBases ( const SbName ,
SoBaseList ,
SoType   
) [static]
int SoBase::getRefCount ( ) const [inline]

Definition at line 256 of file SoBase.h.

virtual SoType SoBase::getTypeId ( ) const [pure virtual]

Implemented in SoPath.

SbBool SoBase::hasMultipleWriteRefs ( ) const [inline, protected]

Definition at line 177 of file SoBase.h.

static void SoBase::incrementCurrentWriteCounter ( ) [inline, static]

Definition at line 215 of file SoBase.h.

static void SoBase::initClass ( ) [static]

Reimplemented in SoBoolOperation, SoCalculator, SoComputeBoundingBox, SoConcatenate, SoCounter, SoElapsedTime, SoEngine, SoFieldConverter, SoGate, SoInterpolate, SoOneShot, SoOnOff, SoSelectOne, SoTimeCounter, SoTransformVec3f, SoTriggerAny, SoFieldContainer, SoUpgrader, SoV1CustomNode, SoAnnotation, SoArray, SoAsciiText, SoBaseColor, SoBlinker, SoCallback, SoCamera, SoClipPlane, SoColorIndex, SoComplexity, SoCone, SoCoordinate3, SoCoordinate4, SoCube, SoCylinder, SoDirectionalLight, SoDrawStyle, SoEnvironment, SoEventCallback, SoFaceSet, SoFile, SoFont, SoFontStyle, SoGroup, SoIndexedFaceSet, SoIndexedLineSet, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoIndexedShape, SoIndexedTriangleSet, SoIndexedTriangleStripSet, SoInfo, SoLabel, SoLevelOfDetail, SoLight, SoLightModel, SoLinearProfile, SoLineSet, SoLocateHighlight, SoLOD, SoMaterial, SoMaterialBinding, SoMatrixTransform, SoMultipleCopy, SoNode, SoNonIndexedShape, SoNormal, SoNormalBinding, SoNurbsCurve, SoNurbsProfile, SoNurbsSurface, SoOrthographicCamera, SoPackedColor, SoPathSwitch, SoPendulum, SoPerspectiveCamera, SoPickStyle, SoPointLight, SoPointSet, SoProfile, SoProfileCoordinate2, SoProfileCoordinate3, SoQuadMesh, SoResetTransform, SoRotation, SoRotationXYZ, SoRotor, SoScale, SoSeparator, SoShape, SoShapeHints, SoShuttle, SoSphere, SoSpotLight, SoSwitch, SoText2, SoText3, SoTexture2, SoTexture2Transform, SoTextureCoordinate2, SoTextureCoordinateBinding, SoTextureCoordinateDefault, SoTextureCoordinateEnvironment, SoTextureCoordinateFunction, SoTextureCoordinatePlane, SoTransform, SoTransformation, SoTransformSeparator, SoTranslation, SoTriangleStripSet, SoUnits, SoVertexProperty, SoVertexShape, SoWWWAnchor, SoWWWInline, SoPath, SoUnknownEngine, SoUnknownNode, SoCenterballDragger, SoDirectionalLightDragger, SoDragger, SoDragPointDragger, SoHandleBoxDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTabPlaneDragger, SoTrackballDragger, SoTransformBoxDragger, SoTransformerDragger, SoTranslate1Dragger, SoTranslate2Dragger, SoCenterballManip, SoDirectionalLightManip, SoHandleBoxManip, SoJackManip, SoPointLightManip, SoSpotLightManip, SoTabBoxManip, SoTrackballManip, SoTransformBoxManip, SoTransformerManip, SoTransformManip, SoInteractionKit, SoAntiSquish, SoSelection, SoSurroundScale, SoPolygonOffset, SoAppearanceKit, SoBaseKit, SoCameraKit, SoLightKit, SoNodeKitListPart, SoSceneKit, SoSeparatorKit, SoShapeKit, and SoWrapperKit.

SbBool SoBase::isOfType ( SoType  type) const

Otherwise, it returns FALSE. For example,

 nodePtr->isOfType(SoGroup::getClassTypeId())

returns TRUE if nodePtr is an instance of SoGroup or one of its subclasses.

virtual void SoBase::notify ( SoNotList list) [virtual]

The default method here does not create and add a new record. It merely propagates the current record list to all auditors. This method may be used by subclasses to do the propagation after modifying the list appropriately.

Reimplemented in SoEngine, SoFieldContainer, SoBlinker, SoIndexedShape, SoNode, SoSeparator, and SoVertexShape.

static SbBool SoBase::read ( SoInput in,
SoBase *&  base,
SoType  expectedType 
) [static]

Returns pointer to read-in instance in base, or NULL on EOF. Returns FALSE on error. The last parameter is a subclass type to match. If the returned base is not of this type, it is an error. A type of SoBase::getClassTypeId() will match any base.

virtual SbBool SoBase::readInstance ( SoInput in,
unsigned short  flags 
) [protected, pure virtual]

Return FALSE on error. If reading binary file format, the flags specify whether the object was written as an engine or a group; unknown nodes and groups need this information to read themselves in properly.

Implemented in SoElapsedTime, SoEngine, SoOneShot, SoTimeCounter, SoFieldContainer, SoFile, SoGroup, SoMaterialBinding, SoNormalBinding, SoSeparator, SoTexture2, SoTextureCoordinateBinding, SoWWWInline, SoUnknownNode, SoInteractionKit, SoBaseKit, and SoNodeKitListPart.

void SoBase::ref ( ) const

Instances should be referenced when they will be used outside of the routine in which they were initialized. (A typical example of this is maintaining a pointer to the root of a graph.) Whenever the reference count for an instance is decremented to 0, the instance is automatically destroyed by the database (unless unrefNoDelete() is used to unref it). The reference count of a node is automatically incremented when the node is added as a child of another node or when a path points to the node. Likewise, the reference count is automatically decremented when the node is removed as a child or when a path that points to the node is changed or destroyed.

unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero. This is most useful in returning an object to a zero-reference-count state, like it was when it was created by new.

void SoBase::removeAuditor ( void *  auditor,
SoNotRec::Type  type 
)
static void SoBase::removeName ( SoBase ,
const char *   
) [static]
static void SoBase::setInstancePrefix ( const SbString c) [inline, static]

The ivdowngrade converter needs to set it to other than "+" since that was an illegal character for Inventor V1.0 names.

Definition at line 279 of file SoBase.h.

virtual void SoBase::setName ( const SbName name) [virtual]

Object names are preserved when objects are written to or read from files. Object names must not begin with a digit, and must not contain spaces or control characters, single or double quote characters, backslashes, curly braces or the plus character. The isBaseNameChar() and isBaseNameStartChar() methods of SbName can be used to validate names input by users. This method will replace any bad charaters in the name with underscore characters, and will print out an error message if the application is using the Inventor debugging library.

SbBool SoBase::shouldWrite ( )
virtual void SoBase::startNotify ( ) [virtual]

The default method does nothing, because some classes (path, sensor) never initiate notification. This is used by touch().

Reimplemented in SoNode.

void SoBase::touch ( ) [inline]

This will notify auditors (parent nodes, connected engines, and so on) of a change to this object and cause attached sensors to be triggered.

Definition at line 124 of file SoBase.h.

void SoBase::unref ( ) const
See also:
ref
void SoBase::unrefNoDelete ( ) const
See also:
ref
void SoBase::writeFooter ( SoOutput out) const [protected]
SbBool SoBase::writeHeader ( SoOutput out,
SbBool  isGroup,
SbBool  isEngine 
) const [protected]

writeHeader returns TRUE if no further writing is necessary for an instance. isEngine/isGroup are exactly what they sound like, and must be passed in so that unknown nodes/engines can be correctly created when reading the binary file format.


Member Data Documentation

unsigned int SoBase::hasName

Definition at line 305 of file SoBase.h.

unsigned int SoBase::multWriteRef

Definition at line 309 of file SoBase.h.

Definition at line 244 of file SoBase.h.

unsigned int SoBase::writeCounter

Definition at line 302 of file SoBase.h.

Definition at line 313 of file SoBase.h.


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