Belle II Software  release-08-01-10
PXDLocalDAQFile.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <iosfwd>
12 #include <memory>
13 #include <string>
14 
15 namespace Belle2 {
23  public:
25  explicit PXDLocalDAQFile(const std::string& filename);
29  PXDLocalDAQFile(const PXDLocalDAQFile&) = delete;
33  int status() const;
34 
36  int read(char* buf, int max);
38  int read_data(char* data, size_t len);
39 
40  private:
42  void openFile(std::string filename);
43 
44  private:
45 
46  std::string m_filename;
47  int m_fd{ -1};
48  bool m_compressed{false};
49  std::unique_ptr<std::ios> m_stream;
51  };
52 
54 }
A class to manage I/O for a chain of blocked files.
PXDLocalDAQFile & operator=(const PXDLocalDAQFile &)=delete
No assignment.
int read_data(char *data, size_t len)
Read a record from a file.
void openFile(std::string filename)
actually open the file
std::unique_ptr< std::ios > m_stream
pointer to the filtering input or output stream
bool m_compressed
is file bzip2 compressed?
int status() const
Returns status after constructor call.
PXDLocalDAQFile(const PXDLocalDAQFile &)=delete
No copying.
std::string m_filename
Name of the opened file.
int m_fd
file descriptor.
PXDLocalDAQFile(const std::string &filename)
Constructor.
int read(char *buf, int max)
Read a record from a file.
Abstract base class for different kinds of events.