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 using the clone() virtual copy constructor.

Definition at line 12 of file DeepCopyPointerByClone.h.

Constructor & Destructor Documentation

◆ ~DeepCopyPointerByClone()

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

Definition at line 14 of file DeepCopyPointerByClone.h.

◆ DeepCopyPointerByClone() [1/4]

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

Definition at line 15 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 19 of file DeepCopyPointerByClone.h.

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

◆ DeepCopyPointerByClone() [4/4]

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

Definition at line 38 of file DeepCopyPointerByClone.h.

38 : theData(other.theData) { other.theData = nullptr; }

Member Function Documentation

◆ operator bool()

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

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

Definition at line 63 of file DeepCopyPointerByClone.h.

63 { return theData != 0; }

◆ operator*() [1/2]

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

Definition at line 44 of file DeepCopyPointerByClone.h.

44  {
45  assert(theData);
46  return *theData;
47  }
assert(be >=bs)

◆ operator*() [2/2]

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

Definition at line 48 of file DeepCopyPointerByClone.h.

48  {
49  assert(theData);
50  return *theData;
51  }
assert(be >=bs)

◆ operator->() [1/2]

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

Definition at line 53 of file DeepCopyPointerByClone.h.

53  {
54  assert(theData);
55  return theData;
56  }
assert(be >=bs)

◆ operator->() [2/2]

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

Definition at line 57 of file DeepCopyPointerByClone.h.

57  {
58  assert(theData);
59  return theData;
60  }
assert(be >=bs)

◆ operator=() [1/2]

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

Definition at line 26 of file DeepCopyPointerByClone.h.

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

◆ operator=() [2/2]

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

Definition at line 39 of file DeepCopyPointerByClone.h.

39  {
40  std::swap(theData, other.theData);
41  return *this;
42  }
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 66 of file DeepCopyPointerByClone.h.

66 { return theData == otherP; }

Member Data Documentation

◆ theData

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