a2dRefCount Class Reference
[base classes used for many others]

simple ref counted class to maintain a wxObject* as if it is a smart pointer More...

#include <gen.h>

List of all members.

Public Member Functions

 a2dRefCount (wxObject *theObjectToWrap)
 constructor
virtual ~a2dRefCount ()
 destructor
wxObject * GetObj ()

Protected Attributes

int m_refcount
 how many references to this object do exist
wxObject * m_object
 the wxObject that is maintained using Smart pointer within here.

Friends

class a2dSmrtPtrBase


Detailed Description

simple ref counted class to maintain a wxObject* as if it is a smart pointer

If you want to store wxObject pointers in a STL template list ( like a2dlist ), that becomes a problem. STL stores object by value, and does not delete the object pointed to when removing a pointer from the list. The trick is to store a2dSmrtPtr< wxObject> in the list, which will automatically delete wxObject when a smart pointer. But a a2dSmrtPtr< wxObject> can not be created since wxObject has no refcounting as needed for a2dSmrtPtr. Now this class wraps the wxObject into a class which does have the refcounting, so one stores a2dSmrtPtr< a2dRefCount > in the STL list instead, and all will be oke.

Definition at line 900 of file gen.h.


The documentation for this class was generated from the following file:
a2dRefCount Class Reference -- Tue Aug 31 18:33:07 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation