EventFile.h
Go to the documentation of this file.
1 #ifndef _io_EventFile_h_
2 #define _io_EventFile_h_
3 
4 #include <io/IoCodes.h>
5 #include <utl/AugerException.h>
6 #include <io/StreamerSwitch.h>
7 
8 #include <string>
9 
10 
11 namespace evt {
12  class Event;
13 }
14 
15 namespace utl {
16  class Branch;
17 }
18 
19 namespace io {
20 
21  class VEventFile;
22 
23 
34  class EventFile {
35 
36  private:
37  // set default switch (constructed with all streamers on)
39 
40  public:
41  EventFile(const Type type = eOffline, utl::Branch* const b = nullptr);
42 
43  EventFile(const std::string& filename,
44  const Mode mode = eRead,
45  const Type type = eOffline,
46  utl::Branch* const b = nullptr,
47  const io::StreamerSwitch& streamerSwitch = EventFile::kDefaultSwitch);
48 
49  ~EventFile();
50 
51  void Open(const std::string& filename,
52  const Mode mode = eRead,
53  utl::Branch* const b = nullptr);
54 
55  void Close();
56 
57  void Write(const evt::Event& event);
58 
60  Status Read(evt::Event& event);
61 
63  Status FindEvent(const unsigned int eventId);
64 
66  Status GotoPosition(const unsigned int position);
67 
68  int GetNEvents();
69 
70  const std::string& GetFilename() const;
71 
72  private:
74  EventFile(const EventFile& eventFile);
76  EventFile& operator=(const EventFile& eventFile);
77 
78  static io::VEventFile* Factory(const std::string& filename,
79  const Mode mode,
80  const Type type,
81  utl::Branch* const branch,
82  const io::StreamerSwitch& streamerSwitch);
83 
87 
88  };
89 
90 }
91 
92 
93 #endif
EventFile(const Type type=eOffline, utl::Branch *const b=nullptr)
Definition: EventFile.cc:41
switches to allow excluding certain parts of Event from streaming
Status FindEvent(const unsigned int eventId)
seek Event id set cursor there
Definition: EventFile.cc:162
io::Type fType
Definition: EventFile.h:85
void Open(const std::string &filename, const Mode mode=eRead, utl::Branch *const b=nullptr)
Definition: EventFile.cc:119
static const io::StreamerSwitch kDefaultSwitch
Definition: EventFile.h:38
Mode
Available open modes.
Definition: IoCodes.h:16
io::StreamerSwitch fStreamerSwitch
Definition: EventFile.h:86
Class representing a document branch.
Definition: Branch.h:107
Status
Return code for seek operation.
Definition: IoCodes.h:24
int GetNEvents()
Definition: EventFile.cc:183
Status Read(evt::Event &event)
read current event, advance cursor by 1
Definition: EventFile.cc:148
const std::string & GetFilename() const
Definition: EventFile.cc:190
void Close()
Definition: EventFile.cc:129
EventFile & operator=(const EventFile &eventFile)
copy disallowed
Interface to file I/O objects.
Definition: EventFile.h:34
io::VEventFile * fVEventFile
Definition: EventFile.h:84
Status GotoPosition(const unsigned int position)
goto by position in the file
Definition: EventFile.cc:173
char * filename
Definition: dump1090.h:266
Type
The type of file that we are acutally opening.
Definition: IoCodes.h:33
static io::VEventFile * Factory(const std::string &filename, const Mode mode, const Type type, utl::Branch *const branch, const io::StreamerSwitch &streamerSwitch)
Definition: EventFile.cc:66
void Write(const evt::Event &event)
Definition: EventFile.cc:137

, generated on Tue Sep 26 2023.