00001
00022 #ifndef VLDCONTEXT_H
00023 #define VLDCONTEXT_H
00024
00025 #include "TObject.h"
00026 #include "Conventions/Detector.h"
00027 #include "Conventions/SimFlag.h"
00028 #include "Validity/VldTimeStamp.h"
00029
00030
00031 #include <iosfwd>
00032
00033 class VldContext;
00034 std::ostream& operator<<(std::ostream& os, const VldContext& vldc);
00035
00036 class VldContext : public TObject {
00037
00038 public:
00039
00040 VldContext();
00041 VldContext(const Detector::Detector_t &detector,
00042 const SimFlag::SimFlag_t mcflag,
00043 const VldTimeStamp &time);
00044 virtual ~VldContext();
00045
00049 const char* AsString(Option_t *option = "") const;
00050
00051 Detector::Detector_t GetDetector() const { return fDetector;}
00052 SimFlag::SimFlag_t GetSimFlag() const { return fSimFlag;}
00053 VldTimeStamp GetTimeStamp() const { return fTimeStamp;}
00054
00057 Bool_t IsNull() const;
00059 Bool_t IsValid() const { return !IsNull(); }
00060
00061 void Print(Option_t *option = "") const;
00062
00063 friend Bool_t operator< (const VldContext &lhs, const VldContext &rhs);
00064 friend Bool_t operator==(const VldContext &lhs, const VldContext &rhs);
00065 friend Bool_t operator!=(const VldContext &lhs, const VldContext &rhs);
00066 friend Bool_t operator<=(const VldContext &lhs, const VldContext &rhs);
00067 friend Bool_t operator> (const VldContext &lhs, const VldContext &rhs);
00068 friend Bool_t operator>=(const VldContext &lhs, const VldContext &rhs);
00069
00070 protected:
00071
00072
00073
00074
00075
00076 Detector::Detector_t fDetector;
00077 SimFlag::SimFlag_t fSimFlag;
00078 VldTimeStamp fTimeStamp;
00079
00080 private:
00081
00082 ClassDef(VldContext,2)
00083
00084 };
00085
00086 #ifndef __CINT__
00087
00088
00089
00090 inline Bool_t operator< (const VldContext &lhs, const VldContext &rhs)
00091 {
00092
00093
00094
00095 if ( lhs.fTimeStamp < rhs.fTimeStamp ) return true;
00096 if ( lhs.fTimeStamp == rhs.fTimeStamp ) {
00097 if ( lhs.fDetector < rhs.fDetector ) return true;
00098 if ( lhs.fDetector == rhs.fDetector ) {
00099 if (lhs.fSimFlag < rhs.fSimFlag ) return true;
00100 }
00101 }
00102 return false;
00103 }
00104
00105 inline Bool_t operator==(const VldContext &lhs, const VldContext &rhs)
00106 {
00107
00108 return
00109 lhs.fDetector == rhs.fDetector &&
00110 lhs.fSimFlag == rhs.fSimFlag &&
00111 lhs.fTimeStamp == rhs.fTimeStamp;
00112 }
00113
00114 inline Bool_t operator!=(const VldContext &lhs, const VldContext &rhs)
00115 {
00116
00117 return
00118 lhs.fDetector != rhs.fDetector ||
00119 lhs.fSimFlag != rhs.fSimFlag ||
00120 lhs.fTimeStamp != rhs.fTimeStamp;
00121 }
00122
00123 inline Bool_t operator<=(const VldContext &lhs, const VldContext &rhs)
00124 {
00125 return (lhs<rhs) || (lhs==rhs);
00126 }
00127
00128 inline Bool_t operator>(const VldContext &lhs, const VldContext &rhs)
00129 {
00130 return !(lhs<rhs) && !(lhs==rhs);
00131 }
00132
00133 inline Bool_t operator>=(const VldContext &lhs, const VldContext &rhs)
00134 {
00135 return !(lhs<rhs);
00136 }
00137
00138 inline VldContext::VldContext()
00139 : fDetector(Detector::kUnknown),
00140 fSimFlag(SimFlag::kUnknown),
00141 fTimeStamp() {
00142
00143 }
00144
00145 inline VldContext::~VldContext() { ; }
00146
00147 #endif
00148 #endif // VLDCONTEXT_H