DGtal 1.4.0
|
Aim: Copy on write shared pointer. More...
#include <DGtal/base/CowPtr.h>
Public Types | |
typedef T | element_type |
Public Member Functions | |
CowPtr (T *p=0) noexcept | |
CowPtr (const CowPtr &r) noexcept | |
CowPtr (const CountedPtr< T > &r, bool) | |
CowPtr & | operator= (const CowPtr &r) |
const T & | operator* () const noexcept |
const T * | operator-> () const noexcept |
const T * | get () const noexcept |
template<typename U = T, typename std::enable_if< ! std::is_const< U >::value >::type * = nullptr> | |
T & | operator* () |
template<typename U = T, typename std::enable_if< ! std::is_const< U >::value >::type * = nullptr> | |
T * | operator-> () |
template<typename U = T, typename std::enable_if< ! std::is_const< U >::value >::type * = nullptr> | |
T * | get () |
bool | operator== (const T *other) const |
bool | operator!= (const T *other) const |
unsigned int | count () const |
T * | drop () |
bool | unique () const noexcept |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
void | copy () |
Private Attributes | |
CountedPtr< T > | myPtr |
Aim: Copy on write shared pointer.
Description of template class 'CowPtr'
Use reference counting as long as the pointed object is not modified. When it is about to be modified, copy it and modify the copy.
typedef T DGtal::CowPtr< T >::element_type |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inline |
Builds a copy-on-write pointer from a counted pointer. Requires an extra dummy parameter in order to solve ambiguities when casting from Clone<T> to CowPtr<T>.
r | any counted pointer |
Definition at line 106 of file CowPtr.h.
|
inlineprivate |
Definition at line 186 of file CowPtr.h.
References DGtal::CowPtr< T >::myPtr.
Referenced by DGtal::CowPtr< T >::get(), DGtal::CowPtr< T >::operator*(), and DGtal::CowPtr< T >::operator->().
|
inline |
|
inline |
|
inline |
Definition at line 145 of file CowPtr.h.
References DGtal::CowPtr< T >::copy(), and DGtal::CowPtr< T >::myPtr.
|
inlinenoexcept |
Definition at line 117 of file CowPtr.h.
References DGtal::CowPtr< T >::myPtr.
Referenced by DGtal::CowPtr< T >::operator!=(), and DGtal::CowPtr< T >::operator==().
bool DGtal::CowPtr< T >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
inline |
Inequality operator !=
other | any other pointer. |
Definition at line 164 of file CowPtr.h.
References DGtal::CowPtr< T >::get().
|
inline |
Definition at line 139 of file CowPtr.h.
References DGtal::CowPtr< T >::copy(), and DGtal::CowPtr< T >::myPtr.
|
inlinenoexcept |
|
inline |
Definition at line 142 of file CowPtr.h.
References DGtal::CowPtr< T >::copy(), and DGtal::CowPtr< T >::myPtr.
|
inlinenoexcept |
|
inline |
Definition at line 107 of file CowPtr.h.
References DGtal::CowPtr< T >::myPtr.
|
inline |
Equality operator ==
other | any other pointer. |
Definition at line 153 of file CowPtr.h.
References DGtal::CowPtr< T >::get().
void DGtal::CowPtr< T >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
inlinenoexcept |
|
private |
Definition at line 182 of file CowPtr.h.
Referenced by DGtal::CowPtr< T >::copy(), DGtal::CowPtr< T >::count(), DGtal::CowPtr< T >::drop(), DGtal::CowPtr< T >::get(), DGtal::CowPtr< T >::get(), DGtal::CowPtr< T >::operator*(), DGtal::CowPtr< T >::operator*(), DGtal::CowPtr< T >::operator->(), DGtal::CowPtr< T >::operator->(), DGtal::CowPtr< T >::operator=(), and DGtal::CowPtr< T >::unique().