#ifndef resource_ptr_h__ #define resource_ptr_h__ namespace LifeGraphics { template class resource_ptr { protected: T* _ptr; int _refCount; public: resource_ptr() :_refCount(0), _ptr(0) { } resource_ptr(T* ptr) :_refCount(0), _ptr(0) { _ptr = ptr; //touch(); } ~resource_ptr(){} T* ptr() {return _ptr;} void resetPtr(T* ptr) { _refCount = 0; _ptr = ptr; // touch(); } resource_ptr& operator=(const resource_ptr& ptr) { //release(); _ptr = ptr._ptr; //_refCount = ptr._refCount; //touch(); return *this; } T* operator->(){return _ptr;} /* void touch() { _refCount++; } void release() { _refCount--; }*/ int refCount() { return _refCount; } }; } #endif