#include <FXRefedObject.h>
intType | The type of the container maintaining the reference count. Usually int or FX::FXAtomicInt | |
lastUsed | Can be FX::Pol::hasLastUsed | |
referrersPolicy | Either FX::Pol::unknownReferrers or FX::Pol::knowReferrers |
delete this
. You of course should override this with anything you like. noMoreReferrers() will never be called more than once and once it has been called, even if the object is not deleted all attempts to open a new reference upon it will return a null reference. If you don't want this, specialise FX::FXRefedObjectImpl::countHolder (see the header file).You can temporarily disable the reference counting mechanism by instantiating a FX::FXRefedObject_DisableCount. This is useful during refed object initialisation where it may end up temporarily opening a reference on itself, thus causing deletion of itself during construction as no other reference exists yet.
A specialisation exists for FX::FXAtomicInt which implements an atomic reference count (despite not actually using FX::FXAtomicInt directly to do it).
Public Member Functions | |
FXRefedObject (const FXRefedObject &o) | |
const type & | refCount () const throw () |
void | resetDying () throw () |
Protected Member Functions | |
virtual void | noMoreReferrers () |
bool | int_increfcount () |
bool | int_decrefcount () |
Friends | |
class | FXRefingObjectImpl::refedObject |
struct | FXRefingObjectImpl::dataHolderI |
class | FXRefedObject_DisableCount |
virtual void FX::FXRefedObject< intType, lastUsed, referrersPolicy >::noMoreReferrers | ( | ) | [inline, protected, virtual] |
Called when the reference count reaches zero.
const type& FX::FXRefedObjectImpl::countHolder< type >::refCount | ( | ) | const throw () [inline, inherited] |
Returns the reference count of this object.
void FX::FXRefedObjectImpl::countHolder< type >::resetDying | ( | ) | throw () [inline, inherited] |
Resets the dying flags.