EUDAQ
 All Classes Namespaces Files Functions Variables Pages
FileReader.hh
1 #ifndef EUDAQ_INCLUDED_FileReader
2 #define EUDAQ_INCLUDED_FileReader
3 
4 #include "eudaq/FileSerializer.hh"
5 #include "eudaq/DetectorEvent.hh"
6 #include "eudaq/StandardEvent.hh"
7 
8 #include <string>
9 
10 #include <memory>
11 
12 namespace eudaq {
13 
14  class DLLEXPORT FileReader {
15  public:
16  FileReader(const std::string &filename,
17  const std::string &filepattern = "");
18 
19  ~FileReader();
20  bool NextEvent(size_t skip = 0);
21  std::string Filename() const { return m_filename; }
22  unsigned RunNumber() const;
23  const eudaq::Event &GetEvent() const;
24  const DetectorEvent &Event() const {
25  return GetDetectorEvent();
26  } // for backward compatibility
27  const DetectorEvent &GetDetectorEvent() const;
28  const StandardEvent &GetStandardEvent() const;
29  std::shared_ptr<eudaq::DetectorEvent> GetDetectorEvent_ptr() {
30  return std::dynamic_pointer_cast<eudaq::DetectorEvent>(m_ev);
31  };
32  void Interrupt() { m_des.Interrupt(); }
33 
34  private:
35  std::string m_filename;
36  FileDeserializer m_des;
37  std::shared_ptr<eudaq::Event> m_ev;
38  unsigned m_ver;
39  };
40 }
41 
42 #endif // EUDAQ_INCLUDED_FileReader
Definition: FileSerializer.hh:25
Definition: StandardEvent.hh:128
Definition: DetectorEvent.hh:12
Definition: Event.hh:38
Definition: FileReader.hh:14