TVldContext.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef VLDCONTEXT_H
00023 #define VLDCONTEXT_H
00024
00025 #include "TObject.h"
00026 #include "DbiDetector.hxx"
00027 #include "DbiSimFlag.hxx"
00028 #include "TVldTimeStamp.hxx"
00029
00030 #include "TSK_DBI_Context.hxx"
00031
00032
00033 #include <iosfwd>
00034
00035
00036 class TVldContext;
00037
00038 class TVldContext : public TObject {
00039
00040 public:
00041
00042 TVldContext();
00043 TVldContext(const TSK_DBI_Context& context);
00044 TVldContext(const DbiDetector::Detector_t &detector,
00045 const DbiSimFlag::SimFlag_t mcflag,
00046 const TVldTimeStamp &time);
00047 virtual ~TVldContext();
00048
00049
00050
00051
00052 const char* AsString(Option_t *option = "") const;
00053
00054 DbiDetector::Detector_t GetDetector() const { return fDetector;}
00055 DbiSimFlag::SimFlag_t GetSimFlag() const { return fSimFlag;}
00056 TVldTimeStamp GetTimeStamp() const { return fTimeStamp;}
00057
00058
00059
00060 Bool_t IsNull() const;
00061
00062 Bool_t IsValid() const { return !IsNull(); }
00063
00064 void Print(Option_t *option = "") const;
00065
00066 friend Bool_t operator< (const TVldContext &lhs, const TVldContext &rhs);
00067 friend Bool_t operator==(const TVldContext &lhs, const TVldContext &rhs);
00068 friend Bool_t operator!=(const TVldContext &lhs, const TVldContext &rhs);
00069 friend Bool_t operator<=(const TVldContext &lhs, const TVldContext &rhs);
00070 friend Bool_t operator> (const TVldContext &lhs, const TVldContext &rhs);
00071 friend Bool_t operator>=(const TVldContext &lhs, const TVldContext &rhs);
00072
00073 protected:
00074
00075
00076
00077
00078
00079 DbiDetector::Detector_t fDetector;
00080 DbiSimFlag::SimFlag_t fSimFlag;
00081 TVldTimeStamp fTimeStamp;
00082
00083 private:
00084
00085 ClassDef(TVldContext,2)
00086
00087 };
00088
00089 std::ostream& operator<<(std::ostream& os, const TVldContext& vldts);
00090
00091 #ifndef __CINT__
00092
00093
00094
00095 inline Bool_t operator< (const TVldContext &lhs, const TVldContext &rhs)
00096 {
00097
00098
00099
00100 if ( lhs.fTimeStamp < rhs.fTimeStamp ) return true;
00101 if ( lhs.fTimeStamp == rhs.fTimeStamp ) {
00102 if ( lhs.fDetector < rhs.fDetector ) return true;
00103 if ( lhs.fDetector == rhs.fDetector ) {
00104 if (lhs.fSimFlag < rhs.fSimFlag ) return true;
00105 }
00106 }
00107 return false;
00108 }
00109
00110 inline Bool_t operator==(const TVldContext &lhs, const TVldContext &rhs)
00111 {
00112
00113 return
00114 lhs.fDetector == rhs.fDetector &&
00115 lhs.fSimFlag == rhs.fSimFlag &&
00116 lhs.fTimeStamp == rhs.fTimeStamp;
00117 }
00118
00119 inline Bool_t operator!=(const TVldContext &lhs, const TVldContext &rhs)
00120 {
00121
00122 return
00123 lhs.fDetector != rhs.fDetector ||
00124 lhs.fSimFlag != rhs.fSimFlag ||
00125 lhs.fTimeStamp != rhs.fTimeStamp;
00126 }
00127
00128 inline Bool_t operator<=(const TVldContext &lhs, const TVldContext &rhs)
00129 {
00130 return (lhs<rhs) || (lhs==rhs);
00131 }
00132
00133 inline Bool_t operator>(const TVldContext &lhs, const TVldContext &rhs)
00134 {
00135 return !(lhs<rhs) && !(lhs==rhs);
00136 }
00137
00138 inline Bool_t operator>=(const TVldContext &lhs, const TVldContext &rhs)
00139 {
00140 return !(lhs<rhs);
00141 }
00142
00143 inline TVldContext::TVldContext()
00144 : fDetector(DbiDetector::kUnknown),
00145 fSimFlag(DbiSimFlag::kUnknown),
00146 fTimeStamp() {
00147
00148 }
00149
00150 inline TVldContext::~TVldContext() { ; }
00151
00152 #endif
00153 #endif // VLDCONTEXT_H