CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IOVSyncValue.h
Go to the documentation of this file.
1 #ifndef DataFormats_FWLite_IOVSyncValue_h
2 #define DataFormats_FWLite_IOVSyncValue_h
3 // -*- C++ -*-
4 //
5 // Package: FWLite
6 // Class : IOVSyncValue
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Wed Aug 3 18:35:24 EDT 2005
19 //
20 
21 // system include files
22 #include <functional>
23 
24 // user include files
27 
28 // forward declarations
29 
30 namespace fwlite {
32 {
33 
34  public:
35  IOVSyncValue();
36  //virtual ~IOVSyncValue();
37  explicit IOVSyncValue(const edm::EventID& iID);
38  explicit IOVSyncValue(const edm::Timestamp& iTime);
39  IOVSyncValue(const edm::EventID& iID, const edm::Timestamp& iTime);
40 
41  // ---------- const member functions ---------------------
42  const edm::EventID& eventID() const { return eventID_;}
44  const edm::Timestamp& time() const {return time_; }
45 
46  bool operator==(const IOVSyncValue& iRHS) const {
47  return doOp<std::equal_to>(iRHS);
48  }
49  bool operator!=(const IOVSyncValue& iRHS) const {
50  return doOp<std::not_equal_to>(iRHS);
51  }
52 
53  bool operator<(const IOVSyncValue& iRHS) const {
54  return doOp<std::less>(iRHS);
55  }
56  bool operator<=(const IOVSyncValue& iRHS) const {
57  return doOp<std::less_equal>(iRHS);
58  }
59  bool operator>(const IOVSyncValue& iRHS) const {
60  return doOp<std::greater>(iRHS);
61  }
62  bool operator>=(const IOVSyncValue& iRHS) const {
63  return doOp<std::greater_equal>(iRHS);
64  }
65 
66  // ---------- static member functions --------------------
67  static const IOVSyncValue& invalidIOVSyncValue();
68  static const IOVSyncValue& endOfTime();
69  static const IOVSyncValue& beginOfTime();
70 
71  // ---------- member functions ---------------------------
72 
73  private:
74  //IOVSyncValue(const IOVSyncValue&); // stop default
75 
76  //const IOVSyncValue& operator=(const IOVSyncValue&); // stop default
77  template< template <typename> class Op >
78  bool doOp(const IOVSyncValue& iRHS) const {
79  bool returnValue = false;
80  if(haveID_ && iRHS.haveID_) {
82  Op<edm::EventID> op;
83  returnValue = op(eventID_, iRHS.eventID_);
84  } else {
85  if(iRHS.eventID_.run() == eventID_.run()) {
86  Op<edm::LuminosityBlockNumber_t> op;
87  returnValue = op(luminosityBlockNumber(), iRHS.luminosityBlockNumber());
88  } else {
89  Op<edm::RunNumber_t> op;
90  returnValue = op(eventID_.run(), iRHS.eventID_.run());
91  }
92  }
93 
94  } else if (haveTime_ && iRHS.haveTime_) {
95  Op<edm::Timestamp> op;
96  returnValue = op(time_, iRHS.time_);
97  } else {
98  //error
99  }
100  return returnValue;
101  }
102 
103  // ---------- member data --------------------------------
106  bool haveID_;
107  bool haveTime_;
108 };
109 
110 }
111 
112 #endif
RunNumber_t run() const
Definition: EventID.h:42
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:98
bool operator>(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:59
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:92
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
bool operator!=(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:49
bool operator>=(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:62
edm::EventID eventID_
Definition: IOVSyncValue.h:104
bool operator<=(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:56
bool operator==(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:46
const edm::Timestamp & time() const
Definition: IOVSyncValue.h:44
edm::Timestamp time_
Definition: IOVSyncValue.h:105
edm::LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:43
bool doOp(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:78
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:87
bool operator<(const IOVSyncValue &iRHS) const
Definition: IOVSyncValue.h:53
const edm::EventID & eventID() const
Definition: IOVSyncValue.h:42