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 {
32  public:
33 
36  : theAliBeamSpot(aliBeamSpot), theAliDet(0), theAliDetUnit(0) {}
37 
40  : theAliBeamSpot(0), theAliDet(aliDet), theAliDetUnit(0) {}
41 
44  : theAliBeamSpot(0), theAliDet(0), theAliDetUnit(aliDetUnit) {}
47 
49  theAliBeamSpot = aliBeamSpot; theAliDet = 0; theAliDetUnit = 0; return *this;}
51  theAliBeamSpot = 0; theAliDet = aliDet; theAliDetUnit = 0; return *this;}
53  theAliBeamSpot = 0; theAliDet = 0; theAliDetUnit = aliDetUnit; return *this;}
54  // Default operator= and default copy constructor are fine, no need to code them here.
55 
56  // conversions to Alignable* etc.
57  operator Alignable* ();
58  operator const Alignable* () const;
59  inline Alignable* operator->() { return this->operator Alignable*();}
60  inline const Alignable* operator->() const { return this->operator const Alignable*();}
61  // explicit call if needed:
62  inline Alignable* alignable() { return this->operator Alignable*();}
63  inline const Alignable* alignable() const { return this->operator const Alignable*();}
64 
65  // explicit access to specific types
67  inline const AlignableBeamSpot* alignableBeamSpot() const { return theAliBeamSpot;}
68  inline AlignableDet* alignableDet() { return theAliDet;}
69  inline const AlignableDet* alignableDet() const { return theAliDet;}
71  inline const AlignableDetUnit* alignableDetUnit() const { return theAliDetUnit;}
72 
74  inline bool isNull() const { return (!theAliBeamSpot && !theAliDet && !theAliDetUnit);}
75 
76  // interface to methods specific for AlignableDet(Unit),
77  // slightly breaking idea of 'pointerness' of this class
80 
81 private:
85 };
86 
87 #endif
AlignableDetOrUnitPtr(AlignableDetUnit *aliDetUnit)
Constructor from AlignableDetUnit* (non-explicit: for automatic conversions)
const AlignableDetUnit * alignableDetUnit() const
bool isNull() const
check for empty pointer
const Alignable * operator->() const
const AlignableBeamSpot * alignableBeamSpot() const
AlignableDetUnit * theAliDetUnit
Pointer to Alignable if it is a DetUnit.
const Alignable * alignable() const
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()
AlignableDetOrUnitPtr & operator=(AlignableBeamSpot *aliBeamSpot)
const AlignmentPositionError * alignmentPositionError() const
alignment position error (see comments in specific classes)
const AlignableDet * alignableDet() const
AlignableDetOrUnitPtr(AlignableDet *aliDet)
Constructor from AlignableDet* (non-explicit: for automatic conversions)