43#ifndef REFCOUNTEDOBJECT_H_INCLUDED
44#define REFCOUNTEDOBJECT_H_INCLUDED
52template <
typename allocatorT =
void>
53class RefCountedObject;
56template <
typename T,
typename allocatorT>
58typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
bool>::type
helper_decRef(
60template <
typename T,
typename allocatorT>
61typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
void>::type
helper_incRef(
64template <
typename T,
typename allocatorT>
65typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value, allocatorT *&>::type
68template <
typename allocatorT>
72 template <
typename T_,
typename allocatorT_>
73 friend typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT_>, T_>::value,
bool>::type
75 template <
typename T_,
typename allocatorT_>
76 friend typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT_>, T_>::value,
void>::type
78 template <
typename T_,
typename allocatorT_>
80 typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT_>, T_>::value, allocatorT_ *&>::type
95template <
typename T,
typename allocatorT>
96typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
bool>::type
helper_decRef(
102 if (ptr->refcount == 0)
103 throw std::bad_alloc();
106 return ptr->refcount == 0;
96typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
bool>::type
helper_decRef( {
…}
108template <
typename T,
typename allocatorT>
109typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
void>::type
helper_incRef(
115 if (ptr->refcount + 1 < ptr->refcount)
116 throw std::runtime_error(
"reference counting failed (overflow)");
109typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value,
void>::type
helper_incRef( {
…}
120template <
typename T,
typename allocatorT>
121typename std::enable_if<std::is_base_of<etiss::RefCountedObject<allocatorT>, T>::value, allocatorT *&>::type
124 return ptr->allocator;
132 helper_incRef<T, typename T::refcount_allocatorT>(ptr);
136typename std::enable_if<std::is_base_of<etiss::RefCountedObject<void>, T>::value,
bool>::type
decRef(T *ptr)
138 bool ret = helper_decRef<T, void>(ptr);
136typename std::enable_if<std::is_base_of<etiss::RefCountedObject<void>, T>::value,
bool>::type
decRef(T *ptr) {
…}
general configuration and logging
friend std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT_ >, T_ >::value, allocatorT_ *& >::type helper_allocator_ptr_ref(T_ *ptr)
friend std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT_ >, T_ >::value, void >::type helper_incRef(T_ *ptr)
RefCountedObject(const RefCountedObject &cpy)
virtual ~RefCountedObject()
RefCountedObject(RefCountedObject &&cpy)
allocatorT refcount_allocatorT
friend std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT_ >, T_ >::value, bool >::type helper_decRef(T_ *ptr)
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT >, T >::value, allocatorT *& >::type helper_allocator_ptr_ref(T *ptr)
std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT >, T >::value, bool >::type helper_decRef(T *ptr)
std::enable_if< std::is_base_of< etiss::RefCountedObject< ObjectPool< T > >, T >::value, bool >::type decRef(T *ptr)
std::enable_if< std::is_base_of< etiss::RefCountedObject< allocatorT >, T >::value, void >::type helper_incRef(T *ptr)