1 #ifndef INC_RefCount_hpp__ 2 #define INC_RefCount_hpp__ 12 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 23 Ref(T* p) : ptr(p), count(1) {}
29 Ref& operator=(
const Ref&);
34 : ref(p ? new Ref(p) : 0)
38 : ref(other.ref ? other.ref->increment() : 0)
43 if (ref && ref->decrement())
49 if (ref && ref->decrement())
57 return ref ? ref->
ptr : 0;
62 return ref ? ref->ptr : 0;
67 return ref ? ref->ptr : 0;
76 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 80 #endif //INC_RefCount_hpp__ Definition: ANTLRException.hpp:15
unsigned int count
Definition: RefCount.hpp:21
RefCount(T *p=0)
Definition: RefCount.hpp:33
#define ANTLR_API
Definition: config.hpp:22
RefCount(const RefCount< T > &other)
Definition: RefCount.hpp:37
T * operator->() const
Definition: RefCount.hpp:60
Definition: RefCount.hpp:19
RefCount< T > & operator=(const RefCount< T > &other)
Definition: RefCount.hpp:46
T *const ptr
Definition: RefCount.hpp:20
Definition: RefCount.hpp:17
~Ref()
Definition: RefCount.hpp:24
struct RefCount::Ref * ref
Ref(T *p)
Definition: RefCount.hpp:23
bool decrement()
Definition: RefCount.hpp:26
~RefCount()
Definition: RefCount.hpp:41
Ref * increment()
Definition: RefCount.hpp:25