ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::SurfacePtrHolderImplDetEl< S > Class Template Reference

#include <SurfaceHolderImpl.h>

Collaboration diagram for Trk::SurfacePtrHolderImplDetEl< S >:

Public Member Functions

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

Static Public Member Functions

static const S * cloneHelper (const S *input)
 Helper for cloning or not when we need depending on if we have an associatedDetectorElement.

Protected Member Functions

 ~SurfacePtrHolderImplDetEl ()

Protected Attributes

const S * m_associatedSurface = nullptr

Detailed Description

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

Definition at line 141 of file SurfaceHolderImpl.h.

Constructor & Destructor Documentation

◆ SurfacePtrHolderImplDetEl() [1/5]

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

default ctor

◆ SurfacePtrHolderImplDetEl() [2/5]

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

ctor from const Surface ref.

Definition at line 148 of file SurfaceHolderImpl.h.

150 {}
static const S * cloneHelper(const S *input)
Helper for cloning or not when we need depending on if we have an associatedDetectorElement.

◆ SurfacePtrHolderImplDetEl() [3/5]

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

ctor from const Surface ptr. Takes ownership

Definition at line 152 of file SurfaceHolderImpl.h.

154 {}

◆ SurfacePtrHolderImplDetEl() [4/5]

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

copy ctor

Definition at line 156 of file SurfaceHolderImpl.h.

◆ SurfacePtrHolderImplDetEl() [5/5]

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

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

Definition at line 161 of file SurfaceHolderImpl.h.

162 {
163 // tranfer ownership and leave other nullptr
165 other.m_associatedSurface = nullptr;
166 }

◆ ~SurfacePtrHolderImplDetEl()

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

Definition at line 224 of file SurfaceHolderImpl.h.

224{ destroySurface(); };
void destroySurface() noexcept
destroySurface deletes the ptr if not null and the surface has not a associatedDetectorElement Useful...

Member Function Documentation

◆ cloneHelper()

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

Helper for cloning or not when we need depending on if we have an associatedDetectorElement.

Definition at line 213 of file SurfaceHolderImpl.h.

214 {
215 return (input && input->associatedDetectorElement() == nullptr
216 ? input->clone()
217 : input);
218 }

◆ destroySurface()

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

destroySurface deletes the ptr if not null and the surface has not a associatedDetectorElement Usefull also for testing

Definition at line 201 of file SurfaceHolderImpl.h.

202 {
204 m_associatedSurface->associatedDetectorElement() == nullptr) {
205 delete m_associatedSurface;
206 }
207 //
208 m_associatedSurface = nullptr;
209 }

◆ operator=() [1/2]

template<typename S>
SurfacePtrHolderImplDetEl & Trk::SurfacePtrHolderImplDetEl< S >::operator= ( const SurfacePtrHolderImplDetEl< 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 169 of file SurfaceHolderImpl.h.

170 {
171 if (this != &other) {
172 destroySurface(); // clean up ourselves
174 }
175 return *this;
176 }

◆ operator=() [2/2]

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

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

Definition at line 179 of file SurfaceHolderImpl.h.

181 {
182 // destroy current surface
184 // steal payload of other and leave it to nullptr
186 other.m_associatedSurface = nullptr;
187 return *this;
188 }

◆ release()

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

release ala unique_ptr release

Definition at line 192 of file SurfaceHolderImpl.h.

193 {
194 const S* tmp = m_associatedSurface;
195 m_associatedSurface = nullptr;
196 return tmp;
197 }

◆ surfacePtr()

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

return the ptr we hold useful for tests

Definition at line 190 of file SurfaceHolderImpl.h.

190{ return m_associatedSurface; }

Member Data Documentation

◆ m_associatedSurface

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

Definition at line 221 of file SurfaceHolderImpl.h.


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