cee::RefCountedObject Class Reference

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

Public Member Functions

void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 
Inheritance diagram for cee::RefCountedObject:
cee::app::Models cee::app::Parts cee::app::Plots cee::app::Results cee::app::Selection cee::app::Situations cee::app::States cee::app::Views cee::geo::Data cee::geo::Effect cee::geo::Part cee::geo::PartSettings cee::geo::TextureCoordinates cee::Image cee::ImageResources cee::imp::cae::StateLinearCombination cee::Instance cee::LogDestination cee::LogManager cee::PropertySet cee::PropertySetCollection cee::rep::Repository cee::rep::Snapshot cee::rep::Table cee::ug::ColorMapper cee::ug::ContourLines cee::ug::CustomResultFunction cee::ug::CustomResultGenerator cee::ug::CuttingPlane cee::ug::DataElements cee::ug::DataElementSet cee::ug::DataGeometry cee::ug::DataNodes cee::ug::DataNodeSet cee::ug::DataPart cee::ug::DataPartDisplacement cee::ug::DataPartScalar cee::ug::DataPartSymmetricTensor cee::ug::DataPartVector cee::ug::DataPartVisibility cee::ug::DataReader cee::ug::DataResultDisplacement cee::ug::DataResultGroup cee::ug::DataResultScalar cee::ug::DataResultSymmetricTensor cee::ug::DataResultTransformation cee::ug::DataResultVector cee::ug::DataResultVisibility cee::ug::DataSource cee::ug::DataSourceDirectory cee::ug::DataState cee::ug::DisplacementSettings cee::ug::Isosurface cee::ug::Isovolume cee::ug::ParticleTraceGroup cee::ug::PartSettings cee::ug::PartSettingsTexture cee::ug::ScalarSettings cee::ug::Situation cee::ug::SituationIo cee::ug::VectorSettings cee::ug::VTFxMemoryFile cee::vis::Camera cee::vis::CameraInputHandler cee::vis::Clipping cee::vis::Font cee::vis::MarkupPart cee::vis::Model cee::vis::OpenGLContextGroup cee::vis::Overlay cee::vis::OverlayItem cee::vis::ScalarMapper cee::vis::View

Detailed Description

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

See Smart pointers for more information.

Warning
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.

Member Function Documentation

void cee::RefCountedObject::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().

int cee::RefCountedObject::refCount ( ) const

Returns the reference count for this object.

void cee::RefCountedObject::release ( ) const

Decrements the reference count for this object.

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

void cee::RefCountedObject::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.