00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef EVENTINFO_EVENTID_H
00011 # define EVENTINFO_EVENTID_H
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <iostream>
00022
00023
00024
00025
00026
00027
00028 class EventID {
00029 public:
00030
00031 typedef unsigned int number_type;
00032
00033 EventID();
00034 EventID(number_type run_number,
00035 number_type event_number);
00036 EventID(number_type run_number,
00037 number_type event_number,
00038 number_type time_stamp);
00039 explicit EventID(const EventID& id);
00040 virtual ~EventID();
00041
00042 number_type run_number (void) const;
00043 number_type event_number (void) const;
00044 number_type time_stamp (void) const;
00045
00046
00047 friend bool operator<(const EventID& lhs, const EventID& rhs);
00048 friend bool operator>(const EventID& lhs, const EventID& rhs);
00049 friend bool operator==(const EventID& lhs, const EventID& rhs);
00050 friend bool operator!=(const EventID& lhs, const EventID& rhs);
00051 friend bool operator<=(const EventID& lhs, const EventID& rhs);
00052 friend bool operator>=(const EventID& lhs, const EventID& rhs);
00053
00054
00055 friend std::istream& operator>>(std::istream& is, EventID& rhs);
00056
00057 template <class STR>
00058 friend STR& operator<<(STR& os, const EventID& rhs);
00059
00060 private:
00061 number_type m_run_number;
00062 number_type m_event_number;
00063
00064
00065 number_type m_time_stamp;
00066
00067 };
00068
00069
00070
00071
00072 inline bool operator<(const EventID& lhs, const EventID& rhs) {
00073
00074
00075 return lhs.m_run_number<rhs.m_run_number ||
00076 ( lhs.m_run_number==rhs.m_run_number &&
00077 lhs.m_event_number<rhs.m_event_number) ;
00078 }
00079 inline bool operator==(const EventID& lhs, const EventID& rhs) {
00080 return lhs.m_run_number==rhs.m_run_number &&
00081 lhs.m_event_number==rhs.m_event_number ;
00082 }
00083 inline bool operator>(const EventID& lhs, const EventID& rhs) {
00084 return !( (lhs < rhs) || (lhs == rhs));
00085 }
00086 inline bool operator!=(const EventID& lhs, const EventID& rhs) {
00087 return !(lhs == rhs);
00088 }
00089 inline bool operator<=(const EventID& lhs, const EventID& rhs) {
00090 return !(lhs > rhs);
00091 }
00092 inline bool operator>=(const EventID& lhs, const EventID& rhs) {
00093 return !(lhs < rhs);
00094 }
00095
00096 template <class STR>
00097 inline STR& operator<<(STR& os, const EventID& rhs) {
00098 os << "[R,E] = [" << rhs.m_run_number << "," << rhs.m_event_number << "]";
00099 return os;
00100 }
00101
00102 inline std::istream& operator>>(std::istream& is, EventID& rhs) {
00103 is >> rhs.m_run_number >> rhs.m_event_number;
00104 return is;
00105 }
00106
00107
00108
00109 #endif // EVENTINFO_EVENTID_H
00110
00111
00112
00113
00114
00115