29 #ifndef __AGG_UTIL__REF_COUNTED_OBJECT_H__
30 #define __AGG_UTIL__REF_COUNTED_OBJECT_H__
106 RCObjectSet _liveObjects;
167 typedef std::list<UseCountHitZeroCB*> PreDeleteCBList;
188 virtual int ref()
const;
200 virtual int unref()
const throw();
227 std::
string printRCObject() const;
239 void executeAndClearPreDeleteCallbacks();
252 PreDeleteCBList _preDeleteCallbacks;
306 if (rhs._obj != _obj)
380 :
std::runtime_error(msg)
478 removeMeAsListener();
491 if (pAboutToDie != _pObj)
494 "executeUseCountHitZeroCB() called with mismatched raw pointers!");
503 void removeMeAsListener()
507 _pObj->removePreDeleteCB(
this);
511 void addMeAsListener()
515 _pObj->addPreDeleteCB(
this);
Exception class for all errors from WeakRCPtr
WeakRCPtr(RCPtr< T > src)
virtual std::string toString() const
Just prints the count and address.
RCObjectPool()
Create an empty pool.
std::set< RCObject * > RCObjectSet
void addPreDeleteCB(UseCountHitZeroCB *pCB)
Add uniquely.
bool empty() const
Will getting a lock() return a null?
virtual int unref() const
Decrease the reference count by one.
void deleteAllObjects()
Call delete on all objects remaining in _liveObjects and clear it out.
A monitoring "pool" class for created RCObject's which allows us to forcibly delete any RCOBject's re...
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
T * refAndGet() const
If not null, ref() the object and then return it.
virtual ~UseCountHitZeroCB()
RCObject(RCObjectPool *pool=0)
If the pool is given, the object will be released back to the pool when its count hits 0...
WeakRCPtr()
Default contains NULL.
virtual void executeUseCountHitZeroCB(RCObject *pAboutToDie)
Listener callback from the RCObject to implement the interface.
void removePreDeleteCB(UseCountHitZeroCB *pCB)
Remove it exists.
virtual int ref() const
Increase the reference count by one.
A reference to an RCObject which automatically ref() and deref() on creation and destruction.
void release(RCObject *pObj, bool shouldDelete=true)
Tell the pool that the object's count is 0 and it can be released to be deleted or potentially reused...
CURL * init(char *error_buffer)
Get's a new instance of CURL* and performs basic configuration of that instance.
A base class for a simple reference counted object.
BadWeakPtr(const std::string &msg)
Interface for registering callbacks to the RCObject for when the usecount hits 0 but before the deall...
bool contains(RCObject *pObj) const
virtual ~RCObjectPool()
Forcibly delete all remaining objects in pool, regardless of ref count.
virtual int getRefCount() const
Get the current reference count.
bool expired() const
Will getting a lock() return a null?
virtual void executeUseCountHitZeroCB(RCObject *pAboutToDie)=0
A variant of boost::weak_ptr that uses our intrusive RCObject counting.
WeakRCPtr & operator=(const WeakRCPtr &r)
void clear()
Remove any listener and NULL the wrapped pointer.
RCPtr & operator=(const RCPtr &rhs)
void add(RCObject *pObj)
Add the object to the pool uniquely.
Interface class for a reference counted object.
virtual void removeFromPool() const
If the object is in an auto-delete pool, remove it from the pool and force it to only delete when it'...