CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
EventID.h
Go to the documentation of this file.
1/***************************************************************************
2 EventInfo Package
3 -----------------------------------------
4 Copyright (C) 2000 by ATLAS Collaboration
5 ***************************************************************************/
6
7//<doc><file> $Id: EventID.h,v 1.1.1.1 2007/04/25 11:46:57 zoujh Exp $
8//<version> $Name: HltDataTypes-01-01-03 $
9
10#ifndef EVENTINFO_EVENTID_H
11# define EVENTINFO_EVENTID_H
12
13//<<<<<< INCLUDES >>>>>>
14//<<<<<< PUBLIC DEFINES >>>>>>
15//<<<<<< PUBLIC CONSTANTS >>>>>>
16//<<<<<< PUBLIC TYPES >>>>>>
17//<<<<<< PUBLIC VARIABLES >>>>>>
18//<<<<<< PUBLIC FUNCTIONS >>>>>>
19//<<<<<< CLASS DECLARATIONS >>>>>>
20
21#include <iostream>
22
23//
24// class EventID
25//
26// This class provides a unique identification for each event.
27//
28class EventID {
29public:
30
31 typedef unsigned int number_type;
32
33 EventID();
39 explicit EventID(const EventID& id);
40 virtual ~EventID();
41
42 number_type run_number (void) const;
43 number_type event_number (void) const;
44 number_type time_stamp (void) const; // posix time in seconds from 1970
45
46 // Comparison operators
47 friend bool operator<(const EventID& lhs, const EventID& rhs);
48 friend bool operator>(const EventID& lhs, const EventID& rhs);
49 friend bool operator==(const EventID& lhs, const EventID& rhs);
50 friend bool operator!=(const EventID& lhs, const EventID& rhs);
51 friend bool operator<=(const EventID& lhs, const EventID& rhs);
52 friend bool operator>=(const EventID& lhs, const EventID& rhs);
53
54 // Insertion and extraction operators
55 friend std::istream& operator>>(std::istream& is, EventID& rhs);
56
57 template <class STR>
58 friend STR& operator<<(STR& os, const EventID& rhs);
59
60private:
61 number_type m_run_number;
62 number_type m_event_number;
63
64 // posix time in seconds since 1970/01/01
65 number_type m_time_stamp;
66
67};
68
69
70//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
71
72inline bool operator<(const EventID& lhs, const EventID& rhs) {
73 // We are assuming that ALL events will have run and event numbers,
74 // and never just a time stamp.
75 return lhs.m_run_number<rhs.m_run_number ||
76 ( lhs.m_run_number==rhs.m_run_number &&
77 lhs.m_event_number<rhs.m_event_number) ;
78}
79inline bool operator==(const EventID& lhs, const EventID& rhs) {
80 return lhs.m_run_number==rhs.m_run_number &&
81 lhs.m_event_number==rhs.m_event_number ;
82}
83inline bool operator>(const EventID& lhs, const EventID& rhs) {
84 return !( (lhs < rhs) || (lhs == rhs));
85}
86inline bool operator!=(const EventID& lhs, const EventID& rhs) {
87 return !(lhs == rhs);
88}
89inline bool operator<=(const EventID& lhs, const EventID& rhs) {
90 return !(lhs > rhs);
91}
92inline bool operator>=(const EventID& lhs, const EventID& rhs) {
93 return !(lhs < rhs);
94}
95
96template <class STR>
97inline STR& operator<<(STR& os, const EventID& rhs) {
98 os << "[R,E] = [" << rhs.m_run_number << "," << rhs.m_event_number << "]";
99 return os;
100}
101
102inline std::istream& operator>>(std::istream& is, EventID& rhs) {
103 is >> rhs.m_run_number >> rhs.m_event_number;
104 return is;
105}
106
107//<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
108
109#endif // EVENTINFO_EVENTID_H
110
111
112
113
114
115
std::istream & operator>>(std::istream &is, EventID &rhs)
Definition EventID.h:102
bool operator==(const EventID &lhs, const EventID &rhs)
Definition EventID.h:79
bool operator<(const EventID &lhs, const EventID &rhs)
Definition EventID.h:72
bool operator>(const EventID &lhs, const EventID &rhs)
Definition EventID.h:83
bool operator>=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:92
bool operator<=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:89
STR & operator<<(STR &os, const EventID &rhs)
Definition EventID.h:97
bool operator!=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:86
number_type run_number(void) const
Definition EventID.cxx:55
friend std::istream & operator>>(std::istream &is, EventID &rhs)
Definition EventID.h:102
friend bool operator==(const EventID &lhs, const EventID &rhs)
Definition EventID.h:79
friend bool operator<(const EventID &lhs, const EventID &rhs)
Definition EventID.h:72
unsigned int number_type
Definition EventID.h:31
virtual ~EventID()
Definition EventID.cxx:51
friend bool operator>(const EventID &lhs, const EventID &rhs)
Definition EventID.h:83
number_type time_stamp(void) const
Definition EventID.cxx:67
friend bool operator>=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:92
EventID()
Definition EventID.cxx:22
number_type event_number(void) const
Definition EventID.cxx:61
friend bool operator<=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:89
friend STR & operator<<(STR &os, const EventID &rhs)
Definition EventID.h:97
friend bool operator!=(const EventID &lhs, const EventID &rhs)
Definition EventID.h:86