MeVisLab Toolbox Reference
ml::RefCountedBase Class Reference

RefCountedBase class adds intrusive reference counting support to the Base class. More...

#include <mlRefCountedBase.h>

Inheritance diagram for ml::RefCountedBase:
ml::EventSource ml::Base ml::AbstractItemModel ml::CSOList ml::DicomConfigurableMessageFilterBaseRefCounted ml::DicomTree ml::MultiFileVolumeListRefCounted ml::PCLBaseObject ml::SelectedClusters ml::WEM

Public Member Functions

 RefCountedBase ()
 Constructor. More...
 
 RefCountedBase (const RefCountedBase &)
 Explicit copy constructor. More...
 
virtual void incRefCount () const
 Increase reference count. More...
 
virtual void decRefCount () const
 Decrease ref count (object will be deleted if ref count is decremented to 0) More...
 
bool isRefCountedBase () const override
 Returns if the instance is derived from RefCountedBase. More...
 
- Public Member Functions inherited from ml::EventSource
 EventSource ()
 
 EventSource (const EventSource &evSource)
 
 ~EventSource () override
 
void addEventListener (BaseEventCallback *cb, void *userData)
 add event listener callback to this Base object - the userData will be the first argument when the callback is called More...
 
void removeEventListener (BaseEventCallback *cb, void *userData)
 remove event listener callback from this Base object - arguments must be the same as for the addEventListener call More...
 
bool hasEventListeners () const
 check if any event listeners have been added to this Base object; this can be used to skip the sendEvent call (and the potentially expensive building of the event object) altogether More...
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
virtual BasedeepCopy () const
 Set addStateToTree version number that can be accessed via getAddStateVersion() More...
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument. More...
 
virtual std::string detailString () const
 Return a string describing this object. More...
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class. More...
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state. More...
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState(). More...
 
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node. More...
 
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node. More...
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object. More...
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object. More...
 

Static Public Member Functions

static void updateReferenceCountingIfSupported (Base *oldValue, Base *newValue, bool &isRefCountedBase)
 Helper method that handles inc/dec of ref count if base instances support it. More...
 

Protected Member Functions

 ~RefCountedBase () override
 Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. More...
 
- Protected Member Functions inherited from ml::EventSource
void sendEvent (BaseEvent *event, void *skipListener=nullptr)
 Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. More...
 
- Protected Member Functions inherited from ml::Base
virtual char * getPersistentState () const
 Returns a C string describing the object's internal state. More...
 
virtual void setPersistentState (const char *)
 Restores the object's internal state from a string that had been previously generated using getPersistentState(). More...
 
virtual void clearPersistentState (char *) const
 Disposes a string previously allocated by getPersistentState(). More...
 

Protected Attributes

MLint32 _refCount
 Reference count. More...
 

Additional Inherited Members

- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 

Detailed Description

RefCountedBase class adds intrusive reference counting support to the Base class.

It should be used together with boost::intrusive_ptr and the ML_REFCOUNTED_PTR macro.

Definition at line 29 of file mlRefCountedBase.h.

Constructor & Destructor Documentation

◆ RefCountedBase() [1/2]

ml::RefCountedBase::RefCountedBase ( )

Constructor.

◆ RefCountedBase() [2/2]

ml::RefCountedBase::RefCountedBase ( const RefCountedBase )

Explicit copy constructor.

◆ ~RefCountedBase()

ml::RefCountedBase::~RefCountedBase ( )
overrideprotected

Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h.

Destructor.

Member Function Documentation

◆ decRefCount()

virtual void ml::RefCountedBase::decRefCount ( ) const
virtual

Decrease ref count (object will be deleted if ref count is decremented to 0)

◆ incRefCount()

virtual void ml::RefCountedBase::incRefCount ( ) const
virtual

Increase reference count.

◆ isRefCountedBase()

bool ml::RefCountedBase::isRefCountedBase ( ) const
inlineoverridevirtual

Returns if the instance is derived from RefCountedBase.

Reimplemented from ml::Base.

Definition at line 45 of file mlRefCountedBase.h.

◆ updateReferenceCountingIfSupported()

static void ml::RefCountedBase::updateReferenceCountingIfSupported ( Base oldValue,
Base newValue,
bool &  isRefCountedBase 
)
static

Helper method that handles inc/dec of ref count if base instances support it.

It decrements the ref count of oldValue if supported and not NULL. It increments the ref count of newValue if supported and not NULL. isRefCountedBase must indicate if oldValue supported ref counting. isRefCountedBase will be set to true if the newValue supports ref counting.

Member Data Documentation

◆ _refCount

MLint32 ml::RefCountedBase::_refCount
mutableprotected

Reference count.

Definition at line 63 of file mlRefCountedBase.h.


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