VEventFile.h
Go to the documentation of this file.
1 #ifndef _io_VEventFile_h_
2 #define _io_VEventFile_h_
3 
4 #include <utl/AugerException.h>
5 #include <io/IoCodes.h>
6 #include <string>
7 
8 
9 namespace utl {
10  class Branch;
11 }
12 
13 namespace evt {
14  class Event;
15 }
16 
17 namespace io {
18 
26  class VEventFile {
27 
28  public:
29  VEventFile() { }
30 
31  VEventFile(const std::string& filename, const Mode mode, utl::Branch* const b = nullptr)
32  : fBranch(b) { DefaultOpen(filename, mode); }
33 
34  virtual ~VEventFile() { }
35 
36  // log error, throw excpt
37  virtual void Open(const std::string& filename, const Mode mode = eRead, utl::Branch* const b = nullptr) = 0;
38 
39  virtual void Close() = 0;
40 
41  virtual void Write(const evt::Event& event) = 0;
42 
44  virtual Status Read(evt::Event& event) = 0;
45 
47  virtual Status FindEvent(const unsigned int eventId) = 0;
48 
50  virtual Status GotoPosition(const unsigned int position) = 0;
51 
52  virtual int GetNEvents() = 0;
53 
54  const std::string& GetFilename() const { return fFilename; }
55 
56  protected:
58  VEventFile(const VEventFile& event);
60  VEventFile& operator=(const VEventFile& event);
61 
65  int DefaultWrite(evt::Event& event);
66 
70  int DefaultOpen(const std::string& filename, const Mode mode = eRead);
71 
72  utl::Branch* fBranch = nullptr;
73 
74  std::string fFilename;
76 
77  };
78 
79 }
80 
81 
82 #endif
std::string fFilename
Definition: VEventFile.h:74
virtual ~VEventFile()
Definition: VEventFile.h:34
virtual void Write(const evt::Event &event)=0
const std::string & GetFilename() const
Definition: VEventFile.h:54
virtual int GetNEvents()=0
virtual Status FindEvent(const unsigned int eventId)=0
seek Event id set cursor there
Mode
Available open modes.
Definition: IoCodes.h:16
virtual Status GotoPosition(const unsigned int position)=0
goto by position in the file
virtual Status Read(evt::Event &event)=0
read current event advance cursor by 1
virtual void Open(const std::string &filename, const Mode mode=eRead, utl::Branch *const b=nullptr)=0
utl::Branch * fBranch
Definition: VEventFile.h:72
int DefaultOpen(const std::string &filename, const Mode mode=eRead)
Definition: VEventFile.cc:31
Class representing a document branch.
Definition: Branch.h:107
Status
Return code for seek operation.
Definition: IoCodes.h:24
virtual void Close()=0
VEventFile(const std::string &filename, const Mode mode, utl::Branch *const b=nullptr)
Definition: VEventFile.h:31
VEventFile & operator=(const VEventFile &event)
Assignment operator - not implemented.
char * filename
Definition: dump1090.h:266
int DefaultWrite(evt::Event &event)
Definition: VEventFile.cc:15

, generated on Tue Sep 26 2023.