PCL
pcl::AutoPointerCloner< T, D > Class Template Reference

A smart pointer able to generate dynamically allocated copies of the objects pointed to by other smart pointers. More...

#include <AutoPointer.h>

+ Inheritance diagram for pcl::AutoPointerCloner< T, D >:

Public Types

using const_pointer = typename base_type::const_pointer
 
using deleter = typename base_type::deleter
 
using pointer = typename base_type::pointer
 
using value_type = typename base_type::value_type
 
- Public Types inherited from pcl::AutoPointer< T, StandardDeleter< T > >
using const_pointer = const T *
 
using deleter = StandardDeleter< T >
 
using pointer = T *
 
using value_type = T
 

Public Member Functions

 AutoPointerCloner (base_type &&x)
 
 AutoPointerCloner (bool autoDelete=true, const deleter &d=deleter())
 
 AutoPointerCloner (const AutoPointerCloner &x)
 
 AutoPointerCloner (const base_type &x)
 
 AutoPointerCloner (pointer p, bool autoDelete=true, const deleter &d=deleter())
 
AutoPointerCloneroperator= (base_type &&x)
 
AutoPointerCloneroperator= (const AutoPointerCloner &x)
 
AutoPointerCloneroperator= (const base_type &x)
 
AutoPointerCloneroperator= (pointer p)
 
- Public Member Functions inherited from pcl::AutoPointer< T, StandardDeleter< T > >
 AutoPointer (AutoPointer &&x)
 
 AutoPointer (AutoPointer &x)
 
 AutoPointer (bool autoDelete=true, const deleter &d=deleter())
 
 AutoPointer (pointer p, bool autoDelete=true, const deleter &d=deleter())
 
virtual ~AutoPointer ()
 
deleterDeleter ()
 
const deleterDeleter () const
 
void Destroy ()
 
void DisableAutoDelete (bool disable=true)
 
void EnableAutoDelete (bool enable=true)
 
bool IsAutoDelete () const
 
bool IsNull () const
 
bool IsValid () const
 
 operator bool () const
 
 operator const_pointer () const
 
 operator pointer ()
 
value_typeoperator* ()
 
const value_typeoperator* () const
 
pointer operator-> ()
 
const_pointer operator-> () const
 
AutoPointeroperator= (AutoPointer &&x)
 
AutoPointeroperator= (AutoPointer &x)
 
AutoPointeroperator= (pointer p)
 
pointer Pointer ()
 
const_pointer Pointer () const
 
pointer Ptr ()
 
const_pointer Ptr () const
 
pointer Release ()
 
void Reset ()
 
void SetPointer (pointer p)
 

Detailed Description

template<class T, class D = StandardDeleter<T>>
class pcl::AutoPointerCloner< T, D >

AutoPointerCloner is like AutoPointer, from which it derives publicly, with the only and substantial difference that it makes a dynamically allocated copy (or clone) of the object pointed to by another smart pointer upon copy construction or copy assignment. This is useful in cases where a dynamically allocated data member object must be duplicated automatically by the copy constructors and copy assignment operator of its base class.

See also
AutoPointer

Definition at line 695 of file AutoPointer.h.

Member Typedef Documentation

◆ const_pointer

template<class T , class D = StandardDeleter<T>>
using pcl::AutoPointerCloner< T, D >::const_pointer = typename base_type::const_pointer

Represents a pointer to an immutable object stored in this smart pointer.

Definition at line 714 of file AutoPointer.h.

◆ deleter

template<class T , class D = StandardDeleter<T>>
using pcl::AutoPointerCloner< T, D >::deleter = typename base_type::deleter

Represents the type of the object responsible for object deletion.

Definition at line 719 of file AutoPointer.h.

◆ pointer

template<class T , class D = StandardDeleter<T>>
using pcl::AutoPointerCloner< T, D >::pointer = typename base_type::pointer

Represents a pointer stored in this smart pointer.

Definition at line 709 of file AutoPointer.h.

◆ value_type

template<class T , class D = StandardDeleter<T>>
using pcl::AutoPointerCloner< T, D >::value_type = typename base_type::value_type

Represents the type of the object pointed to by this smart pointer.

Definition at line 704 of file AutoPointer.h.

Constructor & Destructor Documentation

◆ AutoPointerCloner() [1/5]

template<class T , class D = StandardDeleter<T>>
pcl::AutoPointerCloner< T, D >::AutoPointerCloner ( bool  autoDelete = true,
const deleter d = deleter() 
)
inline

Constructs a null smart pointer cloner.

Parameters
autoDeleteInitial state of the automatic deletion feature. The default value is true, so auto deletion is always enabled by default for newly created AutoPointer objects.
dDeleter object, responsible for object destruction when the automatic deletion feature is enabled.

A null smart pointer stores a null pointer, so it does not point to a valid object.

A copy of the specified deleter d will be used. If no deleter is specified, this object will use a default-constructed instance of the deleter template argument class.

Definition at line 739 of file AutoPointer.h.

◆ AutoPointerCloner() [2/5]

template<class T , class D = StandardDeleter<T>>
pcl::AutoPointerCloner< T, D >::AutoPointerCloner ( pointer  p,
bool  autoDelete = true,
const deleter d = deleter() 
)
inline

Constructs a smart pointer cloner to store a given pointer.

Parameters
pThe pointer to store in this AutoPointer instance.
autoDeleteInitial state of the automatic deletion feature. The default value is true, so auto deletion is always enabled by default for newly created AutoPointer objects.
dDeleter object, responsible for object destruction when the automatic deletion feature is enabled.

A copy of the specified deleter d will be used. If no deleter is specified, this object will use a default-constructed instance of the deleter template argument class.

Definition at line 762 of file AutoPointer.h.

◆ AutoPointerCloner() [3/5]

template<class T , class D = StandardDeleter<T>>
pcl::AutoPointerCloner< T, D >::AutoPointerCloner ( const base_type x)
inline

Non-trivial copy constructor. Constructs a smart pointer cloner by making a dynamically allocated copy (or clone) of the object pointed to by the pointer stored in another smart pointer x.

The automatic deletion feature will be enabled for this object if a clone object is generated; otherwise it will be in the same state as it is currently set for the source object x.

Contrarily to the copy constructor of AutoPointer, the source smart pointer x will not be modified in any way by this constructor.

Definition at line 780 of file AutoPointer.h.

◆ AutoPointerCloner() [4/5]

template<class T , class D = StandardDeleter<T>>
pcl::AutoPointerCloner< T, D >::AutoPointerCloner ( const AutoPointerCloner< T, D > &  x)
inline

Copy constructor. Constructs a smart pointer cloner by making a dynamically allocated copy (or clone) of the object pointed to by the pointer stored in another smart pointer cloner x.

The automatic deletion feature will be enabled for this object if a clone object is generated; otherwise it will be in the same state as it is currently set for the source object x.

Contrarily to the copy constructor of AutoPointer, the source smart pointer x will not be modified in any way by this constructor.

Definition at line 801 of file AutoPointer.h.

◆ AutoPointerCloner() [5/5]

template<class T , class D = StandardDeleter<T>>
pcl::AutoPointerCloner< T, D >::AutoPointerCloner ( base_type &&  x)
inline

Move constructor.

Definition at line 813 of file AutoPointer.h.

Member Function Documentation

◆ operator=() [1/4]

template<class T , class D = StandardDeleter<T>>
AutoPointerCloner& pcl::AutoPointerCloner< T, D >::operator= ( base_type &&  x)
inline

Move assignment operator. This function simply calls the base class version of the same operator and returns a reference to this object.

Definition at line 880 of file AutoPointer.h.

◆ operator=() [2/4]

template<class T , class D = StandardDeleter<T>>
AutoPointerCloner& pcl::AutoPointerCloner< T, D >::operator= ( const AutoPointerCloner< T, D > &  x)
inline

Copy assignment operator.

This assignment operator performs the following actions:

(1) If this smart pointer stores a valid (non-null) pointer, and the automatic deletion feature is enabled, the pointed object is destroyed by the deleter object. This behavior is the same as for AutoPointer.

(2) If the other smart pointer x stores a valid (non-null) pointer, a dynamically allocated copy (or clone) of the pointed object will be generated, and a pointer to the newly constructed object will be stored in this instance. In such case, the automatic deletion feature will be enabled for this object; otherwise, it will have the same state as in the source object x, and this object will store a null pointer.

(3) Returns a reference to this object.

In contrast to AutoPointer's copy assignment operator, this operator does not modify the specified source object x in any way.

Definition at line 868 of file AutoPointer.h.

◆ operator=() [3/4]

template<class T , class D = StandardDeleter<T>>
AutoPointerCloner& pcl::AutoPointerCloner< T, D >::operator= ( const base_type x)
inline

Copy assignment from base class operator.

This assignment operator performs the following actions:

(1) If this smart pointer stores a valid (non-null) pointer, and the automatic deletion feature is enabled, the pointed object is destroyed by the deleter object. This behavior is the same as for AutoPointer.

(2) If the other smart pointer x stores a valid (non-null) pointer, a dynamically allocated copy (or clone) of the pointed object will be generated, and a pointer to the newly constructed object will be stored in this instance. In such case, the automatic deletion feature will be enabled for this object; otherwise, it will have the same state as in the source object x, and this object will store a null pointer.

(3) Returns a reference to this object.

In contrast to AutoPointer's copy assignment operator, this operator does not modify the specified source object x in any way.

Definition at line 839 of file AutoPointer.h.

◆ operator=() [4/4]

template<class T , class D = StandardDeleter<T>>
AutoPointerCloner& pcl::AutoPointerCloner< T, D >::operator= ( pointer  p)
inline

Causes this smart pointer cloner to store the specified pointer p. Returns a reference to this object.

This member function is identical to its base class counterpart AutoPointer::operator =( pointer ). It is equivalent to:

Definition at line 895 of file AutoPointer.h.


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