|
libebml_ng
|
A flexible pointer that can store either a strong (shared) or weak pointer. More...
#include <flexptr.h>
Public Member Functions | |
| flexible_ptr () | |
| Default constructor. Initializes with an empty strong pointer. More... | |
| flexible_ptr (const std::nullptr_t &) | |
| Constructs a flexible_ptr that is null. More... | |
| flexible_ptr (const flexible_ptr< T > &other) | |
| Copy constructor. More... | |
| flexible_ptr (flexible_ptr< T > &&other) | |
| Move constructor. More... | |
| flexible_ptr (const ptr< T > &p) | |
| Constructs a flexible_ptr from a strong pointer to T. More... | |
| flexible_ptr (ptr< T > &&p) | |
| Constructs a flexible_ptr from a movable strong pointer to T. More... | |
| flexible_ptr (const ptr< const T > &p) | |
| Constructs a flexible_ptr from a strong pointer to a const T. More... | |
| flexible_ptr (ptr< const T > &&p) | |
| Constructs a flexible_ptr from a movable strong pointer to a const T. More... | |
| flexible_ptr (const wptr< T > &p) | |
| Constructs a flexible_ptr from a weak pointer to T. More... | |
| flexible_ptr (wptr< T > &&p) | |
| Constructs a flexible_ptr from a movable weak pointer to T. More... | |
| flexible_ptr (const wptr< const T > &p) | |
| Constructs a flexible_ptr from a weak pointer to a const T. More... | |
| flexible_ptr (wptr< const T > &&p) | |
| Constructs a flexible_ptr from a movable weak pointer to a const T. More... | |
| ~flexible_ptr () | |
| Destructor. More... | |
| flexible_ptr< T > & | operator= (const flexible_ptr< T > &other) |
| Copy assignment operator. More... | |
| flexible_ptr< T > & | operator= (flexible_ptr< T > &&other) |
| Move assignment operator. More... | |
| flexible_ptr< T > & | operator= (const ptr< T > &other) |
| Assignment operator from a strong pointer of type ptr<T>. More... | |
| flexible_ptr< T > & | operator= (ptr< T > &&other) |
| Assignment operator from a movable strong pointer of type ptr<T>. More... | |
| flexible_ptr< T > & | operator= (const wptr< T > &other) |
| Assignment operator from a weak pointer of type wptr<T>. More... | |
| flexible_ptr< T > & | operator= (wptr< T > &&other) |
| Assignment operator from a movable weak pointer of type wptr<T>. More... | |
| flexible_ptr< T > & | operator= (const ptr< const T > &other) |
| Assignment operator from a strong pointer of type ptr<const T>. More... | |
| flexible_ptr< T > & | operator= (ptr< const T > &&other) |
| Assignment operator from a movable strong pointer of type ptr<const T>. More... | |
| flexible_ptr< T > & | operator= (const wptr< const T > &other) |
| Assignment operator from a weak pointer of type wptr<const T>. More... | |
| flexible_ptr< T > & | operator= (wptr< const T > &&other) |
| Assignment operator from a movable weak pointer of type wptr<const T>. More... | |
| flexible_ptr< T > & | operator= (const std::nullptr_t &) |
| Assignment operator from nullptr. More... | |
| bool | is_const () const |
| Checks whether the stored pointer is pointing to a const object. More... | |
| bool | is_weak () const |
| Checks whether the stored pointer is a weak pointer. More... | |
| ptr< T > | get () const |
| Retrieves the stored strong pointer. More... | |
| ptr< const T > | cget () const |
| Retrieves the stored strong pointer to a const T. More... | |
| bool | notnull () const |
| Checks whether the stored pointer is not null. More... | |
A flexible pointer that can store either a strong (shared) or weak pointer.
The flexible_ptr class provides the ability to select at runtime whether the underlying stored pointer is a strong pointer (ebml_shared_ptr) or a weak pointer (ebml_weak_ptr). It also supports both mutable and const types.
| T | Type of the managed object. |
|
inline |
Default constructor. Initializes with an empty strong pointer.
|
inline |
Constructs a flexible_ptr that is null.
|
inline |
Copy constructor.
Creates a flexible_ptr by copying from another.
| other | The source flexible_ptr. |
|
inline |
Move constructor.
Transfers ownership from another flexible_ptr.
| other | The source flexible_ptr to move. |
|
inline |
Constructs a flexible_ptr from a strong pointer to T.
| p | The strong pointer (ptr<T>) to be stored. |
|
inline |
Constructs a flexible_ptr from a movable strong pointer to T.
| p | The strong pointer (ptr<T>) to be moved in. |
|
inline |
Constructs a flexible_ptr from a strong pointer to a const T.
| p | The strong pointer (ptr<const T>) to be stored. |
|
inline |
Constructs a flexible_ptr from a movable strong pointer to a const T.
| p | The strong pointer (ptr<const T>) to be moved in. |
|
inline |
Constructs a flexible_ptr from a weak pointer to T.
| p | The weak pointer (wptr<T>) to be stored. |
|
inline |
Constructs a flexible_ptr from a movable weak pointer to T.
| p | The weak pointer (wptr<T>) to be moved in. |
|
inline |
Constructs a flexible_ptr from a weak pointer to a const T.
| p | The weak pointer (wptr<const T>) to be stored. |
|
inline |
Constructs a flexible_ptr from a movable weak pointer to a const T.
| p | The weak pointer (wptr<const T>) to be moved in. |
|
inline |
Destructor.
Calls the appropriate destructor for the underlying pointer.
|
inline |
Retrieves the stored strong pointer to a const T.
Always returns a strong pointer that treats the managed object as const.
| std::runtime_error | if an unexpected flag value is encountered. |
|
inline |
Retrieves the stored strong pointer.
Returns a strong pointer to T. Throws if the underlying pointer is const.
| std::runtime_error | if non-const access is requested on a const object. |
|
inline |
Checks whether the stored pointer is pointing to a const object.
|
inline |
Checks whether the stored pointer is a weak pointer.
|
inline |
Checks whether the stored pointer is not null.
The check is performed based on the type of pointed object (strong or weak).
| std::runtime_error | if an unexpected flag value is encountered. |
|
inline |
Copy assignment operator.
Assigns from another flexible_ptr.
| other | The source flexible_ptr. |
|
inline |
Move assignment operator.
Transfers the pointer held by another flexible_ptr.
| other | The source flexible_ptr. |
|
inline |
Assignment operator from a strong pointer of type ptr<T>.
| other | The strong pointer to assign from. |
|
inline |
Assignment operator from a movable strong pointer of type ptr<T>.
| other | The strong pointer to move in. |
|
inline |
Assignment operator from a weak pointer of type wptr<T>.
| other | The weak pointer to assign from. |
|
inline |
Assignment operator from a movable weak pointer of type wptr<T>.
| other | The weak pointer to move in. |
|
inline |
Assignment operator from a strong pointer of type ptr<const T>.
| other | The strong pointer to const T to assign from. |
|
inline |
Assignment operator from a movable strong pointer of type ptr<const T>.
| other | The strong pointer to const T to move in. |
|
inline |
Assignment operator from a weak pointer of type wptr<const T>.
| other | The weak pointer to assign from. |
|
inline |
Assignment operator from a movable weak pointer of type wptr<const T>.
| other | The weak pointer to move in. |
|
inline |
Assignment operator from nullptr.
Resets the flexible_ptr to an empty strong pointer.
| ptr<const T> ebml::flexible_ptr< T >::const_sp |
Stored strong pointer for const T.
| wptr<const T> ebml::flexible_ptr< T >::const_wp |
Stored weak pointer for const T.
| ptr<T> ebml::flexible_ptr< T >::sp |
Stored strong pointer for mutable T.
| wptr<T> ebml::flexible_ptr< T >::wp |
Stored weak pointer for mutable T.
1.8.14