ATLAS Offline Software
EventStream.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef JIVEXML_EVENTSTREAM_H
6 #define JIVEXML_EVENTSTREAM_H
7 
8 #include <string>
9 #include <map>
10 
11 namespace JiveXML {
12 
19  class EventStreamID {
20 
21  public:
22 
23  //Constructor with all parameters
24  EventStreamID( unsigned long EventNumber, unsigned int RunNumber, const std::string& StreamName ) :
26  };
27 
28  //Constructor with all paramters and char *
29  EventStreamID( unsigned long EventNumber, unsigned int RunNumber, const char* StreamName ) :
31  //Check for NULL pointer
33  };
34 
35  //Constructor with just a stream name - usefull for searching in the map
36  EventStreamID( const std::string& StreamName ) :
38  };
39 
40  //Get the different values
41  unsigned long EventNumber() const { return m_event; };
42  unsigned int RunNumber() const { return m_run; };
43  std::string StreamName() const { return m_stream; };
44  const char* StreamNameCStr() const { return m_stream.c_str(); };
45 
46  //Check wether two EventStreamIDs are refering to the same event
47  bool isSameEvent ( const EventStreamID& id ) const {
48  return (( id.StreamName() == m_stream ) &&
49  ( id.RunNumber() == m_run ) &&
50  ( id.EventNumber() == m_event ));
51  }
52 
53  //Check wether the ID is valid, i.e. stream name, run and event number
54  //greater / greater-equal zero
55  bool isValid () const {
56  return (( !m_stream.empty() ) && ( m_run != 0 ) && ( m_event != 0 ));
57  }
58 
59  //Define comparision operators for the map,
60  //i.e. only based on stream name, which is the key
61  inline bool operator == ( const EventStreamID& id ) const {
62  return ( id.StreamName() == m_stream );
63  }
64 
65  inline bool operator < ( const EventStreamID& id ) const {
66  return ( id.StreamName() < m_stream );
67  }
68 
69  private:
70 
71  //the event number
72  unsigned int m_event;
73  //the run number
74  unsigned int m_run;
75  //the stream name
76  std::string m_stream;
77  };
78 
86  typedef std::pair< const EventStreamID, const std::string> EventStreamPair;
87  typedef std::map< const EventStreamID, const std::string> EventStreamMap;
88 
89 } //namespace
90 
91 #endif
92 
JiveXML::EventStreamID::m_event
unsigned int m_event
Definition: EventStream.h:72
JiveXML::EventStreamID::EventStreamID
EventStreamID(unsigned long EventNumber, unsigned int RunNumber, const char *StreamName)
Definition: EventStream.h:29
JiveXML::EventStreamID::EventNumber
unsigned long EventNumber() const
Definition: EventStream.h:41
JiveXML::EventStreamMap
std::map< const EventStreamID, const std::string > EventStreamMap
Definition: EventStream.h:87
JiveXML::EventStreamID::StreamNameCStr
const char * StreamNameCStr() const
Definition: EventStream.h:44
JiveXML::EventStreamID::EventStreamID
EventStreamID(const std::string &StreamName)
Definition: EventStream.h:36
JiveXML::EventStreamID::isSameEvent
bool isSameEvent(const EventStreamID &id) const
Definition: EventStream.h:47
JiveXML::EventStreamID::m_stream
std::string m_stream
Definition: EventStream.h:76
JiveXML::EventStreamID::isValid
bool isValid() const
Definition: EventStream.h:55
JiveXML::EventStreamPair
std::pair< const EventStreamID, const std::string > EventStreamPair
A map that stores events according to their EventStreamID Due to the way EventStreamID is build,...
Definition: EventStream.h:86
JiveXML::EventStreamID
For the client-server communication, each event is uniquely identified by the run number,...
Definition: EventStream.h:19
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:21
JiveXML::EventStreamID::StreamName
std::string StreamName() const
Definition: EventStream.h:43
JiveXML::EventStreamID::m_run
unsigned int m_run
Definition: EventStream.h:74
JiveXML::EventStreamID::operator==
bool operator==(const EventStreamID &id) const
Definition: EventStream.h:61
JiveXML::EventStreamID::RunNumber
unsigned int RunNumber() const
Definition: EventStream.h:42
JiveXML::EventStreamID::EventStreamID
EventStreamID(unsigned long EventNumber, unsigned int RunNumber, const std::string &StreamName)
Definition: EventStream.h:24
JiveXML::EventStreamID::operator<
bool operator<(const EventStreamID &id) const
Definition: EventStream.h:65