19 #ifndef BAKERY_UTILITIES_SHAREDPTR_H
20 #define BAKERY_UTILITIES_SHAREDPTR_H
30 template<
typename T_obj >
75 inline operator bool()
const;
81 inline const T_obj*
obj()
const;
92 template<
typename T_obj>
94 : m_pRefCount(0), m_pobj(0)
99 template<
typename T_obj>
101 : m_pRefCount(0), m_pobj(pobj)
107 template<
typename T_obj>
109 : m_pRefCount(src.m_pRefCount), m_pobj(src.m_pobj)
114 template<
typename T_obj>
137 template<
typename T_obj>
151 template<
typename T_obj>
158 template<
typename T_obj>
165 template<
typename T_obj>
172 template<
typename T_obj>
179 template<
typename T_obj>
186 template <
class T_obj>
190 return (m_pobj != 0);
194 template <
class T_obj>
215 template <
class T_obj>
223 if( (*m_pRefCount) > 0 )
227 if(*m_pRefCount == 0)
263 #endif //BAKERY_UTILITIES_SHAREDPTR_H
T_obj * obj()
Get the underlying instance:
Definition: sharedptr.h:153
T_obj & operator*()
Dereferencing.
Definition: sharedptr.h:167
sharedptr & operator=(const sharedptr &src)
Share ownership.
Definition: sharedptr.h:115
void ref()
Definition: sharedptr.h:196
size_type * m_pRefCount
Definition: sharedptr.h:88
virtual ~sharedptr()
Definition: sharedptr.h:138
T_obj * operator->() const
Dereferencing.
Definition: sharedptr.h:181
size_t size_type
Definition: sharedptr.h:34
T_obj * m_pobj
Definition: sharedptr.h:89
sharedptr()
Allocate a new instance.
Definition: sharedptr.h:93
A shared reference-counting smart-pointer.
Definition: sharedptr.h:31
void unref()
Definition: sharedptr.h:217