10 #include <ememory/debug.hpp> 17 using deleterCall = std::function<void(void* _data)>;
33 template<
typename EMEMORY_TYPE>
35 friend class WeakPtr<EMEMORY_TYPE>;
37 EMEMORY_TYPE* m_element;
39 deleterCall m_deleter;
44 deleterCall createDeleter()
const {
45 return [](
void* _data) {
delete((EMEMORY_TYPE*)_data);};
49 template<
class EMEMORY_TYPE2,
50 typename std::enable_if< std::is_same<EMEMORY_TYPE2, EMEMORY_TYPE>::value
51 && std::is_base_of<ememory::EnableSharedFromThisBase, EMEMORY_TYPE2>::value
54 template<
class EMEMORY_TYPE2,
55 typename std::enable_if< std::is_same<EMEMORY_TYPE2, EMEMORY_TYPE>::value
56 && !std::is_base_of<ememory::EnableSharedFromThisBase, EMEMORY_TYPE2>::value
107 #ifndef PARSE_DOXYGEN 108 template<
class EMEMORY_TYPE2,
109 typename std::enable_if< std::is_base_of<EMEMORY_TYPE, EMEMORY_TYPE2>::value
112 template<
class EMEMORY_TYPE2,
113 typename std::enable_if< std::is_base_of<EMEMORY_TYPE, EMEMORY_TYPE2>::value
137 template<
class EMEMORY_TYPE2>
149 template<
class EMEMORY_TYPE2>
155 const EMEMORY_TYPE*
get()
const;
205 #include <ememory/details/SharedPtr.hxx> WeakPtr is an interface that lose the data pointer when all SharedPtr as been released.
Definition: SharedPtr.hpp:15
const EMEMORY_TYPE * operator->() const
Const dereferences the stored pointer.
SharedPtr()
Contructor empty.
bool operator!=(std::nullptr_t) const
Check if the SharedPtr have NOT an internal data (nullptr)
ememory::Counter * getCounter() const
Get Counter pointer.
Definition: SharedPtr.hpp:190
bool operator==(std::nullptr_t) const
Check if the SharedPtr have an internal data (not nullptr)
void reset()
Reset the SharedPtr ==> Remove data if needed.
Couter is an important part of the SharedPtr/WeakPtr implementation. This use a simple refcounting me...
Definition: Counter.hpp:18
const EMEMORY_TYPE & operator*() const
Get a const reference on the data.
Enable the acces of the self sharedPtr inside an object (note: not availlable in contructor and destr...
Definition: EnableSharedFromThis.hpp:23
int64_t useCount() const
Get the number of conencted SharedPtr.
void swap(SharedPtr< EMEMORY_TYPE > &_obj)
Swap 2 Object inside the SharedPtr.
deleterCall getDeleter() const
Get deleter function of the data pointer.
Definition: SharedPtr.hpp:197
Ememory is a namespace to represent the.
Definition: Counter.hpp:14
SharedPtr & operator=(const SharedPtr< EMEMORY_TYPE > &_obj)
Asignement operator.
ememory::SharedPtr is a smart pointer that retains shared ownership of an object through a pointer...
Definition: SharedPtr.hpp:34