CMS 3D CMS Logo

AlignableDetOrUnitPtr.h
Go to the documentation of this file.
1 #ifndef Alignment_CommonAlignment_AlignableDetOrUnitPtr_H
2 #define Alignment_CommonAlignment_AlignableDetOrUnitPtr_H
3 
24 class Alignable;
25 class AlignableBeamSpot;
26 class AlignableDet;
27 class AlignableDetUnit;
29 
31 public:
34  : theAliBeamSpot(aliBeamSpot), theAliDet(nullptr), theAliDetUnit(nullptr) {}
35 
38  : theAliBeamSpot(nullptr), theAliDet(aliDet), theAliDetUnit(nullptr) {}
39 
42  : theAliBeamSpot(nullptr), theAliDet(nullptr), theAliDetUnit(aliDetUnit) {}
45 
47  theAliBeamSpot = aliBeamSpot;
48  theAliDet = nullptr;
49  theAliDetUnit = nullptr;
50  return *this;
51  }
53  theAliBeamSpot = nullptr;
54  theAliDet = aliDet;
55  theAliDetUnit = nullptr;
56  return *this;
57  }
59  theAliBeamSpot = nullptr;
60  theAliDet = nullptr;
61  theAliDetUnit = aliDetUnit;
62  return *this;
63  }
64  // Default operator= and default copy constructor are fine, no need to code them here.
65 
66  // conversions to Alignable* etc.
67  operator Alignable*();
68  operator const Alignable*() const;
69  inline Alignable* operator->() { return this->operator Alignable*(); }
70  inline const Alignable* operator->() const { return this->operator const Alignable*(); }
71  // explicit call if needed:
72  inline Alignable* alignable() { return this->operator Alignable*(); }
73  inline const Alignable* alignable() const { return this->operator const Alignable*(); }
74 
75  // explicit access to specific types
77  inline const AlignableBeamSpot* alignableBeamSpot() const { return theAliBeamSpot; }
78  inline AlignableDet* alignableDet() { return theAliDet; }
79  inline const AlignableDet* alignableDet() const { return theAliDet; }
81  inline const AlignableDetUnit* alignableDetUnit() const { return theAliDetUnit; }
82 
84  inline bool isNull() const { return (!theAliBeamSpot && !theAliDet && !theAliDetUnit); }
85 
86  // interface to methods specific for AlignableDet(Unit),
87  // slightly breaking idea of 'pointerness' of this class
90 
91 private:
95 };
96 
97 #endif
AlignableDetOrUnitPtr & operator=(AlignableDetUnit *aliDetUnit)
AlignableDetOrUnitPtr(AlignableDetUnit *aliDetUnit)
Constructor from AlignableDetUnit* (non-explicit: for automatic conversions)
AlignableDetOrUnitPtr & operator=(AlignableDet *aliDet)
const AlignableDet * alignableDet() const
const AlignmentPositionError * alignmentPositionError() const
alignment position error (see comments in specific classes)
const Alignable * alignable() const
const Alignable * operator->() const
AlignableDetUnit * theAliDetUnit
Pointer to Alignable if it is a DetUnit.
bool isNull() const
check for empty pointer
AlignableBeamSpot * alignableBeamSpot()
AlignableBeamSpot * theAliBeamSpot
Pointer to Alignable if it is the beam spot.
~AlignableDetOrUnitPtr()
Non-virtual destructor: do not use as base class.
AlignableDet * theAliDet
Pointer to Alignable if it is a Det.
AlignableDetUnit * alignableDetUnit()
AlignableDetOrUnitPtr(AlignableBeamSpot *aliBeamSpot)
Constructor from AlignableBeamSpot* (non-explicit: for automatic conversions)
AlignableDet * alignableDet()
const AlignableBeamSpot * alignableBeamSpot() const
AlignableDetOrUnitPtr & operator=(AlignableBeamSpot *aliBeamSpot)
const AlignableDetUnit * alignableDetUnit() const
AlignableDetOrUnitPtr(AlignableDet *aliDet)
Constructor from AlignableDet* (non-explicit: for automatic conversions)