stream  0.10.0
stream analysis framework
HldFile.h
1 /************************************************************
2  * The Data Acquisition Backbone Core (DABC) *
3  ************************************************************
4  * Copyright (C) 2009 - *
5  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
6  * Planckstr. 1, 64291 Darmstadt, Germany *
7  * Contact: http://dabc.gsi.de *
8  ************************************************************
9  * This software can be used under the GPL license *
10  * agreements as stated in LICENSE.txt file *
11  * which is part of the distribution. *
12  ************************************************************/
13 
14 #ifndef HADAQ_HldFile
15 #define HADAQ_HldFile
16 
17 #ifndef DABC_BinaryFile
18 #include "dabc/BinaryFile.h"
19 #endif
20 
21 #ifndef HADAQ_defines
22 #include "hadaq/definess.h"
23 #endif
24 
25 namespace hadaq {
26 
29  class HldFile : public dabc::BasicFile {
30  protected:
31  uint32_t fRunNumber;
32  bool fEOF;
33 
34  public:
35  HldFile();
36  ~HldFile();
37 
39  bool OpenWrite(const char* fname, uint32_t rid=0);
40 
43  bool OpenRead(const char* fname);
44 
46  void Close();
47 
49  uint32_t GetRunId() const { return fRunNumber; }
50 
52  bool eof() const { return fEOF; }
53 
59  bool ReadBuffer(void* ptr, uint32_t* bufsize, bool onlyevent = false);
60 
64  bool WriteBuffer(void* buf, uint32_t bufsize);
65 
66  };
67 
68 } // end of namespace
69 
70 #endif
Base class for file writing/reading in DABC.
Definition: BinaryFile.h:84
Reading of HLD files.
Definition: HldFile.h:29
bool ReadBuffer(void *ptr, uint32_t *bufsize, bool onlyevent=false)
Read one or several elements to provided user buffer When called, bufsize should has available buffer...
Definition: HldFile.cxx:140
bool WriteBuffer(void *buf, uint32_t bufsize)
Write user buffer to file without reformatting User must be aware about correct formatting of data.
Definition: HldFile.cxx:127
void Close()
Close file.
Definition: HldFile.cxx:110
uint32_t GetRunId() const
Returns runid, assigned with the file.
Definition: HldFile.h:49
bool eof() const
When file open for reading, method returns true when file end was achieved.
Definition: HldFile.h:52
bool OpenWrite(const char *fname, uint32_t rid=0)
Open file with specified name for writing.
Definition: HldFile.cxx:33
uint32_t fRunNumber
! run number
Definition: HldFile.h:31
bool fEOF
! flag indicate that end-of-file was reached
Definition: HldFile.h:32
bool OpenRead(const char *fname)
Opened file for reading.
Definition: HldFile.cxx:65