libebml_ng
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ebml::ebml_weak_ptr< T > Class Template Reference

A drop-in replacement for std::weak_ptr tailored for EBML objects. More...

#include <ptrs.h>

Public Member Functions

 ebml_weak_ptr ()
 
 ebml_weak_ptr (const std::nullptr_t &)
 
 ebml_weak_ptr (const ebml_shared_ptr< T > &sharedPtr)
 
 ebml_weak_ptr (const ebml_weak_ptr< T > &other)
 
 ebml_weak_ptr (ebml_weak_ptr< T > &&other)
 
ebml_weak_ptr< T > & operator= (const ebml_weak_ptr< T > &other)
 
ebml_weak_ptr< T > & operator= (ebml_weak_ptr< T > &&other)
 
 ~ebml_weak_ptr ()
 
ebml_shared_ptr< T > lock () const
 
ebml_shared_ptr< const T > c_lock () const
 
template<typename U >
ebml_shared_ptr< U > lock () const
 
template<typename U >
std::enable_if_t<!std::is_same< T, U >::value, ebml_shared_ptr< U > > c_lock () const
 
bool expired () const
 

Protected Member Functions

 ebml_weak_ptr (control_block *ctl, T *ptr)
 

Protected Attributes

std::mutex mutex
 
control_blockctl = nullptr
 
T * ptr = nullptr
 

Friends

template<typename U , typename V >
ebml_weak_ptr< U > ebml_static_pointer_cast (const ebml_weak_ptr< V > &)
 
template<typename U , typename V >
ebml_weak_ptr< U > ebml_dynamic_pointer_cast (const ebml_weak_ptr< V > &)
 

Detailed Description

template<class T>
class ebml::ebml_weak_ptr< T >

A drop-in replacement for std::weak_ptr tailored for EBML objects.

The ebml_weak_ptr provides a safe mechanism to observe an object managed by ebml_shared_ptr without affecting its lifetime.

Template Parameters
TType of the object being observed.

Constructor & Destructor Documentation

◆ ebml_weak_ptr() [1/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( control_block ctl,
T *  ptr 
)
inlineexplicitprotected

◆ ebml_weak_ptr() [2/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( )
inline

◆ ebml_weak_ptr() [3/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( const std::nullptr_t &  )
inline

◆ ebml_weak_ptr() [4/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( const ebml_shared_ptr< T > &  sharedPtr)
inlineexplicit

◆ ebml_weak_ptr() [5/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( const ebml_weak_ptr< T > &  other)
inline

◆ ebml_weak_ptr() [6/6]

template<class T>
ebml::ebml_weak_ptr< T >::ebml_weak_ptr ( ebml_weak_ptr< T > &&  other)
inline

◆ ~ebml_weak_ptr()

template<class T>
ebml::ebml_weak_ptr< T >::~ebml_weak_ptr ( )
inline

Member Function Documentation

◆ c_lock() [1/2]

template<class T>
ebml_shared_ptr<const T> ebml::ebml_weak_ptr< T >::c_lock ( ) const
inline

◆ c_lock() [2/2]

template<class T>
template<typename U >
std::enable_if_t<!std::is_same<T, U>::value, ebml_shared_ptr<U> > ebml::ebml_weak_ptr< T >::c_lock ( ) const
inline

◆ expired()

template<class T>
bool ebml::ebml_weak_ptr< T >::expired ( ) const
inline

◆ lock() [1/2]

template<class T>
ebml_shared_ptr<T> ebml::ebml_weak_ptr< T >::lock ( ) const
inline

◆ lock() [2/2]

template<class T>
template<typename U >
ebml_shared_ptr<U> ebml::ebml_weak_ptr< T >::lock ( ) const
inline

◆ operator=() [1/2]

template<class T>
ebml_weak_ptr<T>& ebml::ebml_weak_ptr< T >::operator= ( const ebml_weak_ptr< T > &  other)
inline

◆ operator=() [2/2]

template<class T>
ebml_weak_ptr<T>& ebml::ebml_weak_ptr< T >::operator= ( ebml_weak_ptr< T > &&  other)
inline

Friends And Related Function Documentation

◆ ebml_dynamic_pointer_cast

template<class T>
template<typename U , typename V >
ebml_weak_ptr<U> ebml_dynamic_pointer_cast ( const ebml_weak_ptr< V > &  )
friend

◆ ebml_static_pointer_cast

template<class T>
template<typename U , typename V >
ebml_weak_ptr<U> ebml_static_pointer_cast ( const ebml_weak_ptr< V > &  )
friend

Member Data Documentation

◆ ctl

template<class T>
control_block* ebml::ebml_weak_ptr< T >::ctl = nullptr
mutableprotected

◆ mutex

template<class T>
std::mutex ebml::ebml_weak_ptr< T >::mutex
mutableprotected

◆ ptr

template<class T>
T* ebml::ebml_weak_ptr< T >::ptr = nullptr
protected

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