00001 #ifndef Alignment_CommonAlignment_AlignableDetOrUnitPtr_H 00002 #define Alignment_CommonAlignment_AlignableDetOrUnitPtr_H 00003 00024 class Alignable; 00025 class AlignableDet; 00026 class AlignableDetUnit; 00027 00028 class AlignableDetOrUnitPtr 00029 { 00030 public: 00032 inline AlignableDetOrUnitPtr(AlignableDet *aliDet) : theAliDet(aliDet), theAliDetUnit(0) {} 00034 inline AlignableDetOrUnitPtr(AlignableDetUnit *aliDetUnit) 00035 : theAliDet(0), theAliDetUnit(aliDetUnit) {} 00037 inline ~AlignableDetOrUnitPtr() {} 00038 00039 inline AlignableDetOrUnitPtr& operator = (AlignableDet* aliDet) { 00040 theAliDet = aliDet; theAliDetUnit = 0; return *this;} 00041 inline AlignableDetOrUnitPtr& operator = (AlignableDetUnit* aliDetUnit) { 00042 theAliDet = 0; theAliDetUnit = aliDetUnit; return *this;} 00043 // Default operator= and default copy constructor are fine, no need to code them here. 00044 00045 // conversions to Alignable* etc. 00046 operator Alignable* (); 00047 operator const Alignable* () const; 00048 inline Alignable* operator->() { return this->operator Alignable*();} 00049 inline const Alignable* operator->() const { return this->operator const Alignable*();} 00050 // explicit call if needed: 00051 inline Alignable* alignable() { return this->operator Alignable*();} 00052 inline const Alignable* alignable() const { return this->operator const Alignable*();} 00053 00054 // explicit access to specific types 00055 inline AlignableDet* alignableDet() { return theAliDet;} 00056 inline const AlignableDet* alignableDet() const { return theAliDet;} 00057 inline AlignableDetUnit* alignableDetUnit() { return theAliDetUnit;} 00058 inline const AlignableDetUnit* alignableDetUnit() const { return theAliDetUnit;} 00059 00060 inline bool isNull() const { return (!theAliDet && !theAliDetUnit);} 00061 00062 private: 00063 AlignableDet *theAliDet; 00064 AlignableDetUnit *theAliDetUnit; 00065 }; 00066 00067 #endif