Open Inventor Reference
SoBase Class Referenceabstract

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 SoOnOff SoOneShot SoSelectOne SoTimeCounter SoTransformVec3f SoTriggerAny SoUnknownEngine SoBaseColor SoBaseKit SoCallback SoCamera SoClipPlane 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

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.
 
bool 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, bool isFromField=FALSE)
 Adds a reference to the instance when writing.
 
bool 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 bool 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 bool 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.
 
bool hasMultipleWriteRefs () const
 Returns TRUE if the instance has multiple write references.
 
bool writeHeader (SoOutput *out, bool isGroup, bool 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 bool 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 90 of file SoBase.h.

Member Enumeration Documentation

◆ BaseFlags

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 199 of file SoBase.h.

Constructor & Destructor Documentation

◆ SoBase()

SoBase::SoBase ( )
protected

◆ ~SoBase()

virtual SoBase::~SoBase ( )
protectedvirtual

Member Function Documentation

◆ addAuditor()

void SoBase::addAuditor ( void *  auditor,
SoNotRec::Type  type 
)

◆ addName()

static void SoBase::addName ( SoBase ,
const char *   
)
static

◆ addWriteReference()

virtual void SoBase::addWriteReference ( SoOutput out,
bool  isFromField = FALSE 
)
virtual

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

Reimplemented in SoFieldContainer, and SoBaseKit.

◆ decrementCurrentWriteCounter()

static void SoBase::decrementCurrentWriteCounter ( )
inlinestatic

Definition at line 221 of file SoBase.h.

◆ destroy()

virtual void SoBase::destroy ( )
protectedvirtual

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

◆ getAuditors()

const SoAuditorList & SoBase::getAuditors ( )
inline

Definition at line 242 of file SoBase.h.

◆ getClassTypeId()

static SoType SoBase::getClassTypeId ( )
inlinestatic

Definition at line 128 of file SoBase.h.

◆ getCurrentWriteCounter()

static uint32_t SoBase::getCurrentWriteCounter ( )
inlinestaticprotected

Definition at line 174 of file SoBase.h.

◆ getFileFormatName()

virtual const char * SoBase::getFileFormatName ( ) const
protectedvirtual

Reimplemented in SoUnknownEngine, and SoUnknownNode.

◆ getName()

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.

◆ getNamedBase()

static SoBase * SoBase::getNamedBase ( const SbName ,
SoType   
)
static

◆ getNamedBases()

static int SoBase::getNamedBases ( const SbName ,
SoBaseList ,
SoType   
)
static

◆ getRefCount()

int SoBase::getRefCount ( ) const
inline

Definition at line 257 of file SoBase.h.

◆ getTypeId()

virtual SoType SoBase::getTypeId ( ) const
pure virtual

Implemented in SoPath.

◆ hasMultipleWriteRefs()

bool SoBase::hasMultipleWriteRefs ( ) const
inlineprotected

Definition at line 178 of file SoBase.h.

◆ incrementCurrentWriteCounter()

static void SoBase::incrementCurrentWriteCounter ( )
inlinestatic

Definition at line 216 of file SoBase.h.

◆ initClass()

static void SoBase::initClass ( )
static

◆ isOfType()

bool SoBase::isOfType ( SoType  type) const

Otherwise, it returns FALSE. For example,

nodePtr->isOfType(SoGroup::getClassTypeId())
static SoType getClassTypeId()
Returns the type of this class.

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

◆ notify()

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 SoFieldContainer, SoBlinker, SoEngine, SoIndexedShape, SoNode, SoSeparator, and SoVertexShape.

◆ read()

static bool 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.

◆ readInstance()

virtual bool SoBase::readInstance ( SoInput in,
unsigned short  flags 
)
protectedpure 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, SoBaseKit, SoInteractionKit, SoNodeKitListPart, SoFile, SoGroup, SoMaterialBinding, SoNormalBinding, SoSeparator, SoTexture2, SoTextureCoordinateBinding, SoWWWInline, and SoUnknownNode.

◆ ref()

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.

◆ removeAuditor()

void SoBase::removeAuditor ( void *  auditor,
SoNotRec::Type  type 
)

◆ removeName()

static void SoBase::removeName ( SoBase ,
const char *   
)
static

◆ setInstancePrefix()

static void SoBase::setInstancePrefix ( const SbString c)
inlinestatic

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

Definition at line 280 of file SoBase.h.

◆ setName()

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.

◆ shouldWrite()

bool SoBase::shouldWrite ( )

◆ startNotify()

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.

◆ touch()

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 125 of file SoBase.h.

◆ unref()

void SoBase::unref ( ) const
See also
ref

◆ unrefNoDelete()

void SoBase::unrefNoDelete ( ) const
See also
ref

◆ writeFooter()

void SoBase::writeFooter ( SoOutput out) const
protected

◆ writeHeader()

bool SoBase::writeHeader ( SoOutput out,
bool  isGroup,
bool  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

◆ hasName

unsigned int SoBase::hasName

Definition at line 306 of file SoBase.h.

◆ multWriteRef

unsigned int SoBase::multWriteRef

Definition at line 310 of file SoBase.h.

◆ traceRefs

bool SoBase::traceRefs
static

Definition at line 245 of file SoBase.h.

◆ writeCounter

unsigned int SoBase::writeCounter

Definition at line 303 of file SoBase.h.

◆ writeRefFromField

unsigned int SoBase::writeRefFromField

Definition at line 314 of file SoBase.h.


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