MarlinMT  0.1.0
ReaderListener.h
Go to the documentation of this file.
1 #pragma once
2 
3 // -- std headers
4 #include <functional>
5 #include <memory>
6 
7 // -- lcio headers
8 #include <MT/LCReaderListener.h>
9 
10 namespace EVENT {
11  class LCEvent ;
12  class LCRunHeader ;
13 }
14 
15 namespace marlinmt {
16 
17  class EventStore ;
18  class RunHeader ;
19 
47  class ReaderListener : public MT::LCReaderListener {
48  public:
49  using EventFunction = std::function<void(std::shared_ptr<EventStore>)> ;
50  using RunHeaderFunction = std::function<void(std::shared_ptr<RunHeader>)> ;
51 
52  public:
53  ReaderListener() = default ;
54  ~ReaderListener() = default ;
55  ReaderListener(const ReaderListener&) = delete ;
56  ReaderListener &operator=(const ReaderListener&) = delete ;
57 
61  void onEventRead( EventFunction func ) ;
62 
66  void onRunHeaderRead( RunHeaderFunction func ) ;
67 
68  protected:
69  void processEvent( std::shared_ptr<EVENT::LCEvent> event ) override ;
70  void processRunHeader( std::shared_ptr<EVENT::LCRunHeader> rhdr ) override ;
71 
72  private:
74  EventFunction _onEventRead {nullptr} ;
76  RunHeaderFunction _onRunHeaderRead {nullptr} ;
77  };
78 
79 }
80 
std::function< void(std::shared_ptr< RunHeader >)> RunHeaderFunction
ReaderListener class.
std::function< void(std::shared_ptr< EventStore >)> EventFunction