class RefCountedObject

Base class for all reference counted objects with built-in support for intrusive reference counting.

See Smart Pointers for more information.


Classes that derive from this class should not be created on the stack. You should never manually delete them, only use the release() member function.

Subclassed by Image, ImageResources, Instance, LogDestination, LogManager, PropertySet, PropertySetCollection, Models, Parts, Plots, Results, Selection, Situations, States, Views, Data, Effect, Part, PartSettings, TextureCoordinates, StateLinearCombination, Repository, Snapshot, Table, ColorMapper, ContourLines, CustomResultFunction, CuttingPlane, DataElementSet, DataElements, DataGeometry, DataNodeSet, DataNodes, DataPart, DataPartDisplacement, DataPartScalar, DataPartSymmetricTensor, DataPartVector, DataPartVisibility, DataReader, DataResultDisplacement, DataResultGroup, DataResultScalar, DataResultSymmetricTensor, DataResultTransformation, DataResultVector, DataResultVisibility, DataSource, DataSourceDirectory, DataState, DisplacementSettings, Isosurface, Isovolume, PartSettings, PartSettingsTexture, ParticleTraceGroup, ScalarSettings, Situation, SituationIo, VTFxMemoryFile, VectorSettings, Camera, CameraInputHandler, Clipping, Font, MarkupPart, Model, OpenGLContextGroup, Overlay, OverlayItem, ScalarMapper, View

Public Functions

void addRef() const

Increments the reference count for this object.

Objects use a reference counting mechanism to ensure that the lifetime of the object includes the lifetime of references to it. You use addRef() to stabilize a copy of an interface pointer. It can also be called when the life of a cloned pointer must extend beyond the lifetime of the original pointer. The cloned pointer must be released by calling release().

void release() const

Decrements the reference count for this object.

Call this method when you no longer need to use an interface pointer.

int refCount() const

Returns the reference count for this object.

void setRefCountZero() const

Sets the ref count to zero, but DOES NOT delete the object.

After this call, the refCount would be zero and the object is in a similar state with regards to refCount as it was when it was created with the new operator.

Note! Use with caution! The responsibility of the life cycle management of the object is now in the hands of the caller. Any PreRef’s associated with this object must be detached using the PtrRef::detach() method.