31 #if defined(Clone_RECURSES) 32 #error Recursive header files inclusion detected in Clone.h 33 #else // defined(Clone_RECURSES) 35 #define Clone_RECURSES 44 #include "DGtal/base/Common.h" 45 #include "DGtal/base/CountedPtr.h" 46 #include "DGtal/base/CowPtr.h" 265 template <
typename T>
361 inline operator T()
const 365 return T( * static_cast< const T* >(
myPtr ) );
367 TempPtr tmp( const_cast< T* >( static_cast< const T* >(
myPtr ) ) );
368 return T( * static_cast< const T* >(
myPtr ) );
375 return T( std::move( * const_cast<T*>( static_cast< const T* >(
myPtr ) ) ) );
376 default: ASSERT(
false &&
"[Clone::operator T() const] Invalid cast for given type. " );
377 return T( * static_cast< const T* >(
myPtr ) );
397 return CowPtr<T>(
const_cast<T*
>(
static_cast< const T*
>(
myPtr ) ) );
403 return CowPtr<T>(
new T( std::move( * const_cast<T*>( static_cast< const T* >(
myPtr ) ) ) ) );
404 default: ASSERT(
false &&
"[Clone::operator CowPtr<T>() const] Invalid cast for given type. " );
426 return new T( * static_cast< const T* >(
myPtr ) );
428 return const_cast<T*
>(
static_cast< const T*
>(
myPtr ) );
430 return new T( *(
static_cast< const CowPtr<T>*
>(
myPtr )->
get() ) );
434 return new T( std::move( * const_cast<T*>( static_cast< const T* >(
myPtr ) ) ) );
435 default: ASSERT(
false &&
"[T* Clone::operator&() const] Invalid address for given type. " );
480 #endif // !defined Clone_h 482 #undef Clone_RECURSES 483 #endif // else defined(Clone_RECURSES)
Aim: Smart pointer based on reference counts.
Parameter
Internal class that allows to distinguish the different types of parameters.
Clone & operator=(const Clone &other)
Clone(const CountedPtr< T > &ptrT)
Clone(const Clone &other)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
T * _ptr
Acquired pointer.
Internal class that is used for a late deletion of an acquired pointer.
const Parameter myParam
Characterizes the type of the input parameter at clone instanciation.
DGtal is the top-level namespace which contains all DGtal functions and types.
const void *const myPtr
Stores the address of the input parameter for further use.
Aim: Copy on write shared pointer.
Clone(const CowPtr< T > &ptrT)