27 #ifndef __UTILS__REF_PTR_H__INCL__
28 #define __UTILS__REF_PTR_H__INCL__
87 _log(REFPTR__ERROR,
"IncRef() - mDeleted = true. Count is %u",
mRefCount);
104 _log(REFPTR__ERROR,
"DecRef() - mDeleted = true. Count is %u",
mRefCount);
213 X*
get()
const {
return mPtr; }
218 operator bool()
const {
return (
mPtr !=
nullptr ); }
240 return RefPtr( static_cast<X*>( oth.
get() ) );
RefPtr & operator=(const RefPtr< Y > &oth)
Casting copy operator.
#define _log(type, fmt,...)
void DecRef() const
Decrements reference count of object by one.
RefPtr & operator=(const RefPtr &oth)
Copy operator.
virtual ~RefPtr()
Destructor, releases reference.
bool operator==(const RefPtr< Y > &oth) const
Compares two references.
A reference-counted object.
virtual ~RefObject()
Destructor; must be virtual.
void IncRef() const
Increments reference count of object by one.
RefPtr(X *p=nullptr)
Primary constructor.
RefPtr(const RefPtr< Y > &oth)
Casting copy constructor.
size_t mRefCount
Reference count of instance.
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
RefObject(size_t initRefCount)
Initializes reference count.
RefPtr(const RefPtr &oth)
Copy constructor.
X * mPtr
The pointer to the reference-counted object.
Reference-counting-based smart pointer.