21 #ifndef mia_singular_refobj_hh 22 #define mia_singular_refobj_hh 51 virtual void operator ()(T& MIA_PARAM_UNUSED(data))
const = 0;
91 TheObject(
const TheObject& data) =
delete;
92 TheObject&
operator = (
const TheObject& data) =
delete;
100 template <
typename T>
104 template <
typename T>
110 template <
typename T>
113 m_object =
new TheObject(data, d);
116 template <
typename T>
119 m_object = other.m_object;
124 template <
typename T>
129 m_object = other.m_object;
135 template <
typename T>
137 m_object(other.m_object)
139 other.m_object =
nullptr;
142 template <
typename T>
145 if (&other !=
this) {
148 m_object = other.m_object;
149 other.m_object =
nullptr;
155 template <
typename T>
159 if (m_object->del_ref())
163 template <
typename T>
166 return m_object->get();
169 template <
typename T>
173 return m_object->get_refcount();
178 template <
typename T>
186 template <
typename T>
189 assert(m_refcount == 0);
190 m_destructor(m_data);
193 template <
typename T>
199 template <
typename T>
203 return (m_refcount <= 0);
206 template <
typename T>
212 template <
typename T>
~TSingleReferencedObject()
unsigned get_refcount() const
TSingleReferencedObject & operator=(const TSingleReferencedObject< T > &other)
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
virtual void operator()(T &data) const =0
a singulater reference counted object that gets destroyed when the refount goes to zero ...
TSingleReferencedObject()
static const EmptyDestructor empty_destructor
#define NS_MIA_END
conveniance define to end the mia namespace