#include <Inventor/misc/SoBase.h>
Inheritance diagram for SoBase::
Public Methods | |
void | ref (void) const |
void | unref (void) const |
void | unrefNoDelete (void) const |
int32_t | getRefCount (void) const |
void | touch (void) |
virtual SoType | getTypeId (void) const=0 |
SbBool | isOfType (SoType type) const |
virtual SbName | getName (void) const |
virtual void | setName (const SbName &newname) |
virtual void | startNotify (void) |
virtual void | notify (SoNotList *l) |
void | addAuditor (void *const auditor, const SoNotRec::Type type) |
void | removeAuditor (void *const auditor, const SoNotRec::Type type) |
const SoAuditorList & | getAuditors (void) const |
virtual void | addWriteReference (SoOutput *out, SbBool isfromfield=FALSE) |
SbBool | shouldWrite (void) |
Static Public Methods | |
void | initClass (void) |
SoType | getClassTypeId (void) |
void | addName (SoBase *const base, const char *const name) |
void | removeName (SoBase *const base, const char *const name) |
void | incrementCurrentWriteCounter (void) |
void | decrementCurrentWriteCounter (void) |
SoBase * | getNamedBase (const SbName &name, SoType type) |
int | getNamedBases (const SbName &name, SoBaseList &baselist, SoType type) |
SbBool | read (SoInput *in, SoBase *&base, SoType expectedtype) |
void | setInstancePrefix (const SbString &c) |
void | setTraceRefs (SbBool trace) |
SbBool | getTraceRefs (void) |
Protected Types | |
enum | BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 } |
Protected Methods | |
SoBase (void) | |
virtual | ~SoBase () |
virtual void | destroy (void) |
SbBool | hasMultipleWriteRefs (void) const |
SbBool | writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const |
void | writeFooter (SoOutput *out) const |
virtual const char * | getFileFormatName (void) const |
virtual SbBool | readInstance (SoInput *in, unsigned short flags)=0 |
Static Protected Methods | |
uint32_t | getCurrentWriteCounter (void) |
SoBase provides the basic interfaces and methods for doing reference counting, type identification and import/export. All classes in Coin which uses these mechanisms are descendent from this class.
|
For internal use only. |
|
Constructor. The initial reference count will be set to zero. |
|
Destructor. There should not be any normal circumstance where you need to explicitly delete an object derived from the SoBase class, as the reference counting should take care of deallocating unused objects.
|
|
|
Increase the reference count of the object. This might be necessary to do explicitly from user code for certain situations (chiefly to avoid premature deletion), but is usually called from other instances within the Coin library when objects are made dependent on each other.
|
|
Decrease the reference count of an object. If the reference count reaches zero, the object will delete itself. Be careful when explicitly calling this method, beware that you usually need to match user level calls to ref() with calls to either unref() or unrefNoDelete() to avoid memory leaks.
|
|
Decrease reference count, but do not delete ourself if the count reaches zero.
|
|
Returns number of objects referring to this object. NB: this method should not be called during ordinary use, it should only be necessary to use for debugging purposes. |
|
Force an update, in the sense that all objects connected to this will have to re-check the values of their inter-dependent data. This is often used as an effective way of manually triggering a redraw by application programmers. |
|
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting. Usage example:
void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { } else if (node->getTypeId().isOfType(SoGroup::getClassTypeId())) { SoGroup * group = (SoGroup *)node; // safe downward cast, know the type // then something else } } For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overloaded in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on. For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups. Reimplemented in SoPath. |
|
Returns |
|
This static method returns the SoType object associated with objects of this class. Reimplemented in SoNode, SoPath, SoFieldContainer, and SoEngine. |
|
Returns name of object. If no name has been given to this object, the returned SbName will contain the empty string. |
|
Set the name of this object. Characters that are invalid to use as parts of names for SoBase derived objects will be automatically replaced by underscore characters. If the name starts with an invalid character, the new name will be preceded by an underscore character.
|
|
Adds a name<->object mapping to the global dictionary. |
|
Removes a name<->object mapping from the global dictionary. |
|
This is the method which starts the notification sequence after changes. At the end of a notification sequence, all "immediate" sensors (i.e. sensors set up with a zero priority) are triggered. Reimplemented in SoNode. |
|
Notifies all auditors for this instance when changes are made. Reimplemented in SoNode, SoAsciiText, SoText3, SoMaterial, SoPackedColor, SoBlinker, SoImage, SoSeparator, SoTexture2, SoVertexProperty, SoVertexShape, SoFieldContainer, and SoEngine. |
|
Add an auditor to notify whenever the object changes in any significant way.
|
|
Remove an auditor from the list. auditor will then no longer be notified whenever any updates are made to this object.
|
|
Returns list of objects auditing this object.
|
|
This method is used during the first write pass of a write action to count the number of references to this object in the scene graph. Reimplemented in SoFieldContainer, and SoBaseKit. |
|
Returns Note that connections from the fields of fieldcontainer objects is not alone a valid reason for writing out the object -- there must also be at least one reference directly from another SoBase (like a parent/child relationship, for instance). This method will return a valid result only during the second pass of write actions. |
|
For internal use only. |
|
For internal use only. |
|
Returns the object of type, or derived from type, registered under name. If several has been registered under the same name with the same type, returns the last one which was registered.
If no object of a valid type or subtype has been registered with the given name, returns |
|
Returns the number of objects of type type, or derived from type, registered under name. All matches will also be appended to baselist. |
|
Read next SoBase derived instance from the in stream, check that it is derived from expectedtype and place a pointer to the newly allocated instance in base.
If we return 1. End-of-file. Use SoInput::eof() after calling this method to detect end-of-file conditions. 2. in didn't have a valid identifier name at the stream for us to read. This happens either in the case of errors, or when all child nodes of a group has been read. Check if the next character in the stream is a '}' to detect the latter case. 3. A child was given as the "NULL" keyword. This can happen when reading the contents of SoSFNode or SoMFNode fields.
If |
|
Referenced instances of SoBase are written as "DEF NamePrefixNumber" when exported. "Name" is the name of the base instance from setName(), "Prefix" is common for all objects and can be set by this method (default is "+"), and "Number" is a unique id which is necessary if multiple objects have the same name. If you want the prefix to be something else than "+", use this method. |
|
Set to The reference tracing functionality will be disabled in "release versions" of the Coin library. |
|
Return the status of the reference tracing flag.
|
|
Cleans up all hanging references to and from this instance, and then commits suicide. Called automatically when the reference count goes to zero. |
|
Returns |
|
Write out the header of any SoBase derived object. The header consists of the
Alternatively, the object representation may be made up of just the
If the object has been completed just by writing the header (which will be the case if we're writing multiple references of an object), we return
If we return
|
|
This method will terminate the block representing an SoBase derived object. |
|
Returns the class name this object should be written under. Default string returned is the name of the class from the type system. User extensions nodes and engines override this method to return the name of the extension (instead of "UnknownNode" or "UnknownEngine"). |
|
This method is mainly intended for internal use during file import operations. It reads a definition of an instance from the input stream in. The input stream state points to the start of a serialized / persistant representation of an instance of this class type.
flags is used internally during binary import when reading user extension nodes, group nodes or engines. Reimplemented in SoNode, SoFile, SoNormalBinding, SoGroup, SoImage, SoSeparator, SoTexture2, SoTextureCoordinateBinding, SoWWWInline, SoFieldContainer, SoEngine, SoNodeKitListPart, SoBaseKit, and SoInteractionKit. |
|
For internal use only. |