CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DeepCopyPointerByClone< T > Class Template Reference

#include <DeepCopyPointerByClone.h>

Public Member Functions

 DeepCopyPointerByClone ()
 
 DeepCopyPointerByClone (T *t)
 
 DeepCopyPointerByClone (const DeepCopyPointerByClone &other)
 
 DeepCopyPointerByClone (DeepCopyPointerByClone &&other)
 
 operator bool () const
 to allow test like " if (p) {...}" More...
 
Toperator* ()
 
const Toperator* () const
 
Toperator-> ()
 
const Toperator-> () const
 
DeepCopyPointerByCloneoperator= (const DeepCopyPointerByClone &other)
 
DeepCopyPointerByCloneoperator= (DeepCopyPointerByClone &&other)
 
bool operator== (const T *otherP) const
 to allow test like " if (p == &someT) {...}" More...
 
 ~DeepCopyPointerByClone ()
 

Private Attributes

TtheData
 

Detailed Description

template<class T>
class DeepCopyPointerByClone< T >

Same as DeepCopyPointer, except that it copies the object pointed to wsing the clone() virtual copy constructor.

Definition at line 11 of file DeepCopyPointerByClone.h.

Constructor & Destructor Documentation

◆ ~DeepCopyPointerByClone()

template<class T>
DeepCopyPointerByClone< T >::~DeepCopyPointerByClone ( )
inline

Definition at line 13 of file DeepCopyPointerByClone.h.

◆ DeepCopyPointerByClone() [1/4]

template<class T>
DeepCopyPointerByClone< T >::DeepCopyPointerByClone ( )
inline

Definition at line 14 of file DeepCopyPointerByClone.h.

◆ DeepCopyPointerByClone() [2/4]

template<class T>
DeepCopyPointerByClone< T >::DeepCopyPointerByClone ( T t)
inline

◆ DeepCopyPointerByClone() [3/4]

template<class T>
DeepCopyPointerByClone< T >::DeepCopyPointerByClone ( const DeepCopyPointerByClone< T > &  other)
inline

Definition at line 18 of file DeepCopyPointerByClone.h.

18  {
19  if (other.theData)
20  theData = other->clone();
21  else
22  theData = nullptr;
23  }

◆ DeepCopyPointerByClone() [4/4]

template<class T>
DeepCopyPointerByClone< T >::DeepCopyPointerByClone ( DeepCopyPointerByClone< T > &&  other)
inline

Definition at line 37 of file DeepCopyPointerByClone.h.

37 : theData(other.theData) { other.theData = 0; }

Member Function Documentation

◆ operator bool()

template<class T>
DeepCopyPointerByClone< T >::operator bool ( ) const
inline

to allow test like " if (p) {...}"

Definition at line 50 of file DeepCopyPointerByClone.h.

50 { return theData != 0; }

◆ operator*() [1/2]

template<class T>
T& DeepCopyPointerByClone< T >::operator* ( )
inline

Definition at line 43 of file DeepCopyPointerByClone.h.

◆ operator*() [2/2]

template<class T>
const T& DeepCopyPointerByClone< T >::operator* ( ) const
inline

Definition at line 44 of file DeepCopyPointerByClone.h.

◆ operator->() [1/2]

template<class T>
T* DeepCopyPointerByClone< T >::operator-> ( )
inline

Definition at line 46 of file DeepCopyPointerByClone.h.

◆ operator->() [2/2]

template<class T>
const T* DeepCopyPointerByClone< T >::operator-> ( ) const
inline

Definition at line 47 of file DeepCopyPointerByClone.h.

◆ operator=() [1/2]

template<class T>
DeepCopyPointerByClone& DeepCopyPointerByClone< T >::operator= ( const DeepCopyPointerByClone< T > &  other)
inline

Definition at line 25 of file DeepCopyPointerByClone.h.

25  {
26  if (theData != other.theData) {
27  delete theData;
28  if (other.theData)
29  theData = other->clone();
30  else
31  theData = 0;
32  }
33  return *this;
34  }

◆ operator=() [2/2]

template<class T>
DeepCopyPointerByClone& DeepCopyPointerByClone< T >::operator= ( DeepCopyPointerByClone< T > &&  other)
inline

Definition at line 38 of file DeepCopyPointerByClone.h.

38  {
39  std::swap(theData, other.theData);
40  return *this;
41  }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112

◆ operator==()

template<class T>
bool DeepCopyPointerByClone< T >::operator== ( const T otherP) const
inline

to allow test like " if (p == &someT) {...}"

Definition at line 53 of file DeepCopyPointerByClone.h.

53 { return theData == otherP; }

Member Data Documentation

◆ theData

template<class T>
T* DeepCopyPointerByClone< T >::theData
private