DABC (Data Acquisition Backbone Core)  2.9.9
HldFile.h
Go to the documentation of this file.
1 // $Id: HldFile.h 2116 2014-03-17 12:01:37Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef HADAQ_HldFile
17 #define HADAQ_HldFile
18 
19 #ifndef DABC_BinaryFile
20 #include "dabc/BinaryFile.h"
21 #endif
22 
23 #ifndef HADAQ_defines
24 #include "hadaq/defines.h"
25 #endif
26 
27 namespace hadaq {
28 
31  class HldFile : public dabc::BasicFile {
32  protected:
33  uint32_t fRunNumber;
34  bool fEOF;
35 
36  public:
37  HldFile();
38  ~HldFile();
39 
41  bool OpenWrite(const char* fname, uint32_t rid=0, const char* opt = 0);
42 
45  bool OpenRead(const char* fname, const char* opt = 0);
46 
48  void Close();
49 
51  uint32_t GetRunId() const { return fRunNumber; }
52 
54  bool eof() const { return fEOF; }
55 
61  bool ReadBuffer(void* ptr, uint32_t* bufsize, bool onlyevent = false);
62 
66  bool WriteBuffer(void* buf, uint32_t bufsize);
67  };
68 
69 } // end of namespace
70 
71 #endif
Base class for file writing/reading in DABC.
Definition: BinaryFile.h:84
HLD file implementation.
Definition: HldFile.h:31
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:139
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:126
void Close()
Close file.
Definition: HldFile.cxx:108
bool OpenRead(const char *fname, const char *opt=0)
Opened file for reading.
Definition: HldFile.cxx:63
uint32_t GetRunId() const
Returns runid, assigned with the file.
Definition: HldFile.h:51
bool eof() const
When file open for reading, method returns true when file end was achieved.
Definition: HldFile.h:54
uint32_t fRunNumber
Definition: HldFile.h:33
HldFile()
flag indicate that end-of-file was reached
Definition: HldFile.cxx:19
bool fEOF
run number
Definition: HldFile.h:34
bool OpenWrite(const char *fname, uint32_t rid=0, const char *opt=0)
Open file with specified name for writing.
Definition: HldFile.cxx:31
Support for HADAQ - HADES DAQ
Definition: api.h:27