ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Trk::SurfacePtrHolderImpl< S > Class Template Reference

#include <SurfaceHolderImpl.h>

Inheritance diagram for Trk::SurfacePtrHolderImpl< S >:
Collaboration diagram for Trk::SurfacePtrHolderImpl< S >:

Public Member Functions

 SurfacePtrHolderImpl ()=default
 default ctor More...
 
 SurfacePtrHolderImpl (const S &s)
 ctor from const Surface ref. More...
 
 SurfacePtrHolderImpl (const S *s)
 ctor from const Surface ptr. Takes ownership More...
 
 SurfacePtrHolderImpl (const SurfacePtrHolderImpl &other)
 copy ctor More...
 
 SurfacePtrHolderImpl (SurfacePtrHolderImpl &&other) noexcept
 Move constructor we just steal the resource and leave other to point to nullptr. More...
 
SurfacePtrHolderImploperator= (const SurfacePtrHolderImpl &other)
 copy assingmemnt if surface is free we clone/copy. More...
 
SurfacePtrHolderImploperator= (SurfacePtrHolderImpl &&other) noexcept
 Move assignement we just steal the resource and leave other to point to nullptr. More...
 
void destroySurface () noexcept
 destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing More...
 
const S * surfacePtr ()
 return the ptr we hold useful for tests More...
 
const S * release () noexcept
 release ala unique_ptr release More...
 

Static Public Member Functions

static const S * cloneHelper (const S *input)
 Helper for cloning or not when we need depending on if the surface isFree. More...
 

Protected Member Functions

 ~SurfacePtrHolderImpl ()
 

Protected Attributes

const S * m_associatedSurface = nullptr
 

Detailed Description

template<typename S>
class Trk::SurfacePtrHolderImpl< S >

Definition at line 55 of file SurfaceHolderImpl.h.

Constructor & Destructor Documentation

◆ SurfacePtrHolderImpl() [1/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( )
default

default ctor

◆ SurfacePtrHolderImpl() [2/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const S &  s)
inlineexplicit

ctor from const Surface ref.

Definition at line 61 of file SurfaceHolderImpl.h.

63  {}

◆ SurfacePtrHolderImpl() [3/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const S *  s)
inlineexplicit

ctor from const Surface ptr. Takes ownership

Definition at line 65 of file SurfaceHolderImpl.h.

67  {}

◆ SurfacePtrHolderImpl() [4/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const SurfacePtrHolderImpl< S > &  other)
inline

copy ctor

Definition at line 69 of file SurfaceHolderImpl.h.

70  : m_associatedSurface(cloneHelper(other.m_associatedSurface))
71  {}

◆ SurfacePtrHolderImpl() [5/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( SurfacePtrHolderImpl< S > &&  other)
inlinenoexcept

Move constructor we just steal the resource and leave other to point to nullptr.

Definition at line 74 of file SurfaceHolderImpl.h.

75  {
76  // tranfer ownership and leave other nullptr
77  m_associatedSurface = other.m_associatedSurface;
78  other.m_associatedSurface = nullptr;
79  }

◆ ~SurfacePtrHolderImpl()

template<typename S >
Trk::SurfacePtrHolderImpl< S >::~SurfacePtrHolderImpl ( )
inlineprotected

Definition at line 133 of file SurfaceHolderImpl.h.

133 { destroySurface(); };

Member Function Documentation

◆ cloneHelper()

template<typename S >
static const S* Trk::SurfacePtrHolderImpl< S >::cloneHelper ( const S *  input)
inlinestatic

Helper for cloning or not when we need depending on if the surface isFree.

Definition at line 124 of file SurfaceHolderImpl.h.

125  {
126  return (input && input->isFree() ? input->clone() : input);
127  }

◆ destroySurface()

template<typename S >
void Trk::SurfacePtrHolderImpl< S >::destroySurface ( )
inlinenoexcept

destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing

Definition at line 105 of file SurfaceHolderImpl.h.

106  {
107  if (m_associatedSurface && m_associatedSurface->isFree()) {
108  delete m_associatedSurface;
109  }
110  //
111  m_associatedSurface = nullptr;
112  }

◆ operator=() [1/2]

template<typename S >
SurfacePtrHolderImpl& Trk::SurfacePtrHolderImpl< S >::operator= ( const SurfacePtrHolderImpl< S > &  other)
inline

copy assingmemnt if surface is free we clone/copy.

If not we just point to the one owned by detector geometry

Definition at line 82 of file SurfaceHolderImpl.h.

83  {
84  if (this != &other) {
85  destroySurface(); // clean up ourselves
86  m_associatedSurface = cloneHelper(other.m_associatedSurface);
87  }
88  return *this;
89  }

◆ operator=() [2/2]

template<typename S >
SurfacePtrHolderImpl& Trk::SurfacePtrHolderImpl< S >::operator= ( SurfacePtrHolderImpl< S > &&  other)
inlinenoexcept

Move assignement we just steal the resource and leave other to point to nullptr.

Definition at line 93 of file SurfaceHolderImpl.h.

94  {
95  // destroy current surface
97  // steal payload of other and leave it to nullptr
98  this->m_associatedSurface = other.m_associatedSurface;
99  other.m_associatedSurface = nullptr;
100  return *this;
101  }

◆ release()

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::release ( )
inlinenoexcept

release ala unique_ptr release

Definition at line 116 of file SurfaceHolderImpl.h.

117  {
118  const S* tmp = m_associatedSurface;
119  m_associatedSurface = nullptr;
120  return tmp;
121  }

◆ surfacePtr()

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::surfacePtr ( )
inline

return the ptr we hold useful for tests

Definition at line 114 of file SurfaceHolderImpl.h.

114 { return m_associatedSurface; }

Member Data Documentation

◆ m_associatedSurface

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::m_associatedSurface = nullptr
protected

Definition at line 130 of file SurfaceHolderImpl.h.


The documentation for this class was generated from the following file:
Trk::SurfacePtrHolderImpl::cloneHelper
static const S * cloneHelper(const S *input)
Helper for cloning or not when we need depending on if the surface isFree.
Definition: SurfaceHolderImpl.h:124
Trk::SurfacePtrHolderImpl::destroySurface
void destroySurface() noexcept
destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing
Definition: SurfaceHolderImpl.h:105
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Trk::SurfacePtrHolderImpl::m_associatedSurface
const S * m_associatedSurface
Definition: SurfaceHolderImpl.h:130
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147