20 #ifndef _REFERENCECOUNTED_HPP
21 #define _REFERENCECOUNTED_HPP
23 #include <xqilla/framework/XQillaExport.hpp>
27 #define NULLRCP ((void *)0)
40 ++
const_cast<unsigned int&
>(_ref_count);
46 if(--const_cast<unsigned int&>(_ref_count) == 0) {
66 if(
_p != 0)
_p->incrementRefCount();
71 if(
_p != 0)
_p->incrementRefCount();
76 if(
_p != 0)
_p->incrementRefCount();
82 if(
_p != 0)
_p->decrementRefCount();
84 if(
_p != 0)
_p->incrementRefCount();
91 if(
_p != 0)
_p->decrementRefCount();
123 template<
class T1,
class T2>
126 return (
void*)(T1*)a == (
void*)(T2*)b;
129 template<
class T1,
class T2>
132 return (
void*)(T1*)a != (
void*)(T2*)b;
138 return (T*)a == (T*)b;
144 return (T*)a != (T*)b;
Super class for reference counted classes.
Definition: ReferenceCounted.hpp:30
RefCountPointer & operator=(const RefCountPointer< T > &o)
Definition: ReferenceCounted.hpp:79
Super class of all the reference counted wrappers for Items.
Definition: ReferenceCounted.hpp:61
void incrementRefCount() const
Increment the reference count.
Definition: ReferenceCounted.hpp:38
T * _p
Definition: ReferenceCounted.hpp:120
bool operator==(const RefCountPointer< T1 > &a, const RefCountPointer< T2 > &b)
Definition: ReferenceCounted.hpp:124
T * operator->() const
Definition: ReferenceCounted.hpp:94
unsigned int getRefCount() const
Definition: ReferenceCounted.hpp:51
unsigned int _ref_count
Definition: ReferenceCounted.hpp:57
bool operator!=(const RefCountPointer< T1 > &a, const RefCountPointer< T2 > &b)
Definition: ReferenceCounted.hpp:130
RefCountPointer(const RefCountPointer< T2 > &o)
Definition: ReferenceCounted.hpp:69
virtual ~ReferenceCounted()
Definition: ReferenceCounted.hpp:35
bool isNull() const
Definition: ReferenceCounted.hpp:109
virtual void decrementRefCount() const
Decrement the reference count, deleting if it becomes zero.
Definition: ReferenceCounted.hpp:44
bool notNull() const
Definition: ReferenceCounted.hpp:114
RefCountPointer(T *p=0)
Definition: ReferenceCounted.hpp:64
ReferenceCounted()
Definition: ReferenceCounted.hpp:33
~RefCountPointer()
Definition: ReferenceCounted.hpp:89
RefCountPointer(const RefCountPointer< T > &o)
Definition: ReferenceCounted.hpp:74