|
libebml_ng
|
A drop-in replacement for std::shared_ptr tailored for EBML objects. More...
#include <ptrs.h>
Public Member Functions | |
| ebml_shared_ptr () | |
| ebml_shared_ptr (const std::nullptr_t &) | |
| ebml_shared_ptr (T *ptr) | |
Constructs an ebml_shared_ptr that takes ownership of ptr. More... | |
| ebml_shared_ptr (const ebml_shared_ptr< T > &other) | |
| template<class U > | |
| ebml_shared_ptr (const ebml_shared_ptr< U > &other) | |
| ebml_shared_ptr (ebml_shared_ptr< T > &&other) | |
| ~ebml_shared_ptr () | |
| ebml_shared_ptr< T > & | operator= (const ebml_shared_ptr< T > &other) |
| ebml_shared_ptr< T > & | operator= (ebml_shared_ptr< T > &&other) |
| ebml_shared_ptr< T > & | operator= (const std::nullptr_t &) |
| bool | operator== (const std::nullptr_t &) const |
| bool | operator== (const ebml_shared_ptr< T > &other) const |
| template<typename U > | |
| std::enable_if_t<!std::is_same< T, U >::value, ebml_shared_ptr< T > & > | operator= (const ebml_shared_ptr< U > &other) |
| void | swap (ebml_shared_ptr< T > &other) |
| T * | get () const |
| Retrieves the raw pointer to the managed object. More... | |
| T & | operator* () const |
| T * | operator-> () const |
| operator bool () const | |
| int | use_count () const |
Protected Member Functions | |
| ebml_shared_ptr (control_block *ctl, T *ptr) | |
| ebml_shared_ptr (control_block *ctl, T *ptr, const std::unique_lock< std::mutex > &) | |
Protected Attributes | |
| std::mutex | mutex |
| control_block * | ctl = nullptr |
| T * | ptr = nullptr |
Friends | |
| template<typename U > | |
| class | ebml_shared_ptr |
| template<typename U > | |
| class | ebml_weak_ptr |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_dynamic_pointer_cast (const ebml_shared_ptr< V > &) |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_dynamic_pointer_cast (ebml_shared_ptr< V > &&) |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_static_pointer_cast (const ebml_shared_ptr< V > &) |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_static_pointer_cast (ebml_shared_ptr< V > &&) |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_const_pointer_cast (const ebml_shared_ptr< V > &) |
| template<typename U , typename V > | |
| ebml_shared_ptr< U > | ebml_const_pointer_cast (ebml_shared_ptr< V > &&) |
A drop-in replacement for std::shared_ptr tailored for EBML objects.
This custom smart pointer, ebml_shared_ptr, is designed to mimic the behavior of std::shared_ptr while supporting a unique lifetime management scheme required by the EBML library.
Key Features and Usage Guidelines:
this) may be necessary in some designs, it is considered unsafe to do so from within an object's constructor in conjunction with ebml_shared_ptr. The internal control block's valid flag is set to true the moment the first shared pointer is created.valid member is marked as true. After this point, the object is considered active and further manipulation of the valid member is not recommended.Note for Subclassing:
ebmlElement, the construction of the internal weak pointer is already handled by the base class. Users are only expected to use these custom pointer types (ebml_shared_ptr and ebml_weak_ptr) for other classes.| T | The type of the object being managed. |
|
inlineexplicitprotected |
|
inlineexplicitprotected |
|
inline |
|
inline |
|
inlineexplicit |
Constructs an ebml_shared_ptr that takes ownership of ptr.
When the first ebml_shared_ptr for the object is created, the control block's valid member is set to true. It is then unsafe to modify the valid flag or create additional shared pointers from within the object's constructor.
| ptr | Pointer to the object to be managed. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Retrieves the raw pointer to the managed object.
This function returns the pointer stored in the control block. It is expected that the control block's valid flag is already set to true (which happens when the first ebml_shared_ptr is constructed).
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
mutableprotected |
|
mutableprotected |
|
protected |
1.8.14