template<class T>
class TGeoRCPtr< T >
A reference counting-managed pointer for classes derived from TGeoExtension which can be used as C pointer.
Based on CodeProject implementation example
Example:
public:
MyExtension() :
TGeoExtension(), fRC(0) {printf(
"Created MyExtension\n");}
virtual ~MyExtension() {printf("Deleted MyExtension\n");}
virtual void Release() const {assert(fRC > 0); fRC--; if (fRC ==0) delete this;}
void print() const {printf("MyExtension object %p\n", this);}
private:
};
#define ClassDef(name, id)
ABC for user objects attached to TGeoVolume or TGeoNode.
Usage:
(*ptr2).Print();
a2 = 0;
A reference counting-managed pointer for classes derived from TGeoExtension which can be used as C po...
Note:
Event if one forgets to call ptr2 = 0, the object gets delete when the method using ptr2 gets out of scope.
Definition at line 62 of file TGeoRCPtr.h.