ememory::WeakPtr< EMEMORY_TYPE > Class Template Reference

#include <WeakPtr.hpp>

Public Member Functions

 WeakPtr ()
 
 WeakPtr (std::nullptr_t)
 
 WeakPtr (const WeakPtr< EMEMORY_TYPE > &_obj)
 
WeakPtr< EMEMORY_TYPE > & operator= (const WeakPtr< EMEMORY_TYPE > &_obj)
 
 WeakPtr (WeakPtr &&_obj)
 
 WeakPtr (const SharedPtr< EMEMORY_TYPE > &_obj)
 
WeakPtr< EMEMORY_TYPE > & operator= (const SharedPtr< EMEMORY_TYPE > &_obj)
 
WeakPtr< EMEMORY_TYPE > & operator= (std::nullptr_t)
 
template<class EMEMORY_TYPE2 , typename std::enable_if< std::is_void< EMEMORY_TYPE >::value &&!std::is_void< EMEMORY_TYPE2 >::value, int >::type = 0>
 WeakPtr (const SharedPtr< EMEMORY_TYPE2 > &_obj)
 
template<class EMEMORY_TYPE2 , typename std::enable_if< std::is_void< EMEMORY_TYPE >::value &&!std::is_void< EMEMORY_TYPE2 >::value, int >::type = 0>
WeakPtr< EMEMORY_TYPE > & operator= (const SharedPtr< EMEMORY_TYPE2 > &_obj)
 
void reset ()
 
int useCount () const
 
bool expired () const
 
ememory::SharedPtr< EMEMORY_TYPE > lock ()
 
bool operator== (const WeakPtr &_obj)
 
bool operator== (std::nullptr_t) const
 
bool operator!= (const WeakPtr &_obj)
 
bool operator!= (std::nullptr_t) const
 
void swap (WeakPtr &_obj)
 
ememory::CountergetCounter () const
 

Friends

class EnableSharedFromThis< EMEMORY_TYPE >
 
class SharedPtr< EMEMORY_TYPE >
 

Detailed Description

template<typename EMEMORY_TYPE>
class ememory::WeakPtr< EMEMORY_TYPE >

WeakPtr is an interface that lose the data pointer when all SharedPtr as been released.

Constructor & Destructor Documentation

§ WeakPtr() [1/6]

template<typename EMEMORY_TYPE>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( )

Empty Contructor.

§ WeakPtr() [2/6]

template<typename EMEMORY_TYPE>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( std::nullptr_t  )

nullptr contructor

§ WeakPtr() [3/6]

template<typename EMEMORY_TYPE>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( const WeakPtr< EMEMORY_TYPE > &  _obj)

Copy contuctor.

Parameters
[in]_objObject to copy

§ WeakPtr() [4/6]

template<typename EMEMORY_TYPE>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( WeakPtr< EMEMORY_TYPE > &&  _obj)

Copy contructor.

Parameters
[in]_objObject to copy

§ WeakPtr() [5/6]

template<typename EMEMORY_TYPE>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( const SharedPtr< EMEMORY_TYPE > &  _obj)

Const copy asignement.

Parameters
[in]_objObject to copy

§ WeakPtr() [6/6]

template<typename EMEMORY_TYPE>
template<class EMEMORY_TYPE2 , typename std::enable_if< std::is_void< EMEMORY_TYPE >::value &&!std::is_void< EMEMORY_TYPE2 >::value, int >::type = 0>
ememory::WeakPtr< EMEMORY_TYPE >::WeakPtr ( const SharedPtr< EMEMORY_TYPE2 > &  _obj)

Copy contuctor of herited WeakPtr.

Parameters
[in]_objObject to copy

Member Function Documentation

§ expired()

template<typename EMEMORY_TYPE>
bool ememory::WeakPtr< EMEMORY_TYPE >::expired ( ) const

Get the status of the pointer.

Returns
true if the Pointer is lockable
Note
The status chan change in an other thread release the SharedPtr

§ getCounter()

template<typename EMEMORY_TYPE>
ememory::Counter* ememory::WeakPtr< EMEMORY_TYPE >::getCounter ( ) const
inline

Get Counter pointer.

Returns
Pointer on the counter

§ lock()

template<typename EMEMORY_TYPE>
ememory::SharedPtr<EMEMORY_TYPE> ememory::WeakPtr< EMEMORY_TYPE >::lock ( )

Lock in SharedPtr the current Weak pointer.

Returns
created SharedPtr

§ operator!=() [1/2]

template<typename EMEMORY_TYPE>
bool ememory::WeakPtr< EMEMORY_TYPE >::operator!= ( const WeakPtr< EMEMORY_TYPE > &  _obj)

Check if two WeakPtr are different data.

Parameters
[in]_objObject to compare
Returns
true The Object have NOT the same pointer reference, false otherwise

§ operator!=() [2/2]

template<typename EMEMORY_TYPE>
bool ememory::WeakPtr< EMEMORY_TYPE >::operator!= ( std::nullptr_t  ) const

Check if the SharedPtr have NOT an internal data (nullptr)

Returns
true The pointer is asigned, false otherwise

§ operator=() [1/4]

template<typename EMEMORY_TYPE>
WeakPtr<EMEMORY_TYPE>& ememory::WeakPtr< EMEMORY_TYPE >::operator= ( const WeakPtr< EMEMORY_TYPE > &  _obj)

Const copy asignement.

Parameters
[in]_objObject to copy
Returns
Reference on this

§ operator=() [2/4]

template<typename EMEMORY_TYPE>
WeakPtr<EMEMORY_TYPE>& ememory::WeakPtr< EMEMORY_TYPE >::operator= ( const SharedPtr< EMEMORY_TYPE > &  _obj)

Const copy asignement.

Parameters
[in]_objObject to copy
Returns
Reference on this

§ operator=() [3/4]

template<typename EMEMORY_TYPE>
WeakPtr<EMEMORY_TYPE>& ememory::WeakPtr< EMEMORY_TYPE >::operator= ( std::nullptr_t  )

nullptr asignement

Returns
Reference on this

§ operator=() [4/4]

template<typename EMEMORY_TYPE>
template<class EMEMORY_TYPE2 , typename std::enable_if< std::is_void< EMEMORY_TYPE >::value &&!std::is_void< EMEMORY_TYPE2 >::value, int >::type = 0>
WeakPtr<EMEMORY_TYPE>& ememory::WeakPtr< EMEMORY_TYPE >::operator= ( const SharedPtr< EMEMORY_TYPE2 > &  _obj)

Const copy asignement of herited WeakPtr.

Parameters
[in]_objObject to copy
Returns
Reference on this

§ operator==() [1/2]

template<typename EMEMORY_TYPE>
bool ememory::WeakPtr< EMEMORY_TYPE >::operator== ( const WeakPtr< EMEMORY_TYPE > &  _obj)

Check if two WeakPtr are the same data.

Parameters
[in]_objObject to compare
Returns
true The Object have the same pointer reference, false otherwise

§ operator==() [2/2]

template<typename EMEMORY_TYPE>
bool ememory::WeakPtr< EMEMORY_TYPE >::operator== ( std::nullptr_t  ) const

Check if the WeakPtr have an internal data (not nullptr)

Returns
true The pointer is not asigned, false otherwise

§ reset()

template<typename EMEMORY_TYPE>
void ememory::WeakPtr< EMEMORY_TYPE >::reset ( )

Reset the WeakPtr ==> Remove data if needed.

§ swap()

template<typename EMEMORY_TYPE>
void ememory::WeakPtr< EMEMORY_TYPE >::swap ( WeakPtr< EMEMORY_TYPE > &  _obj)

Swap 2 Object inside the WeakPtr.

Parameters
[in]_objObject to swap with

§ useCount()

template<typename EMEMORY_TYPE>
int ememory::WeakPtr< EMEMORY_TYPE >::useCount ( ) const

Get the number of conencted SharedPtr.

Returns
Number of SharedPtr on this data

The documentation for this class was generated from the following files: