9#ifndef DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_UTILS_BUFFEREDFILEREADER_HPP_
10#define DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_UTILS_BUFFEREDFILEREADER_HPP_
17#include <boost/align/aligned_allocator.hpp>
18#include <boost/iostreams/device/file_descriptor.hpp>
19#include <boost/iostreams/filter/lzma.hpp>
20#include <boost/iostreams/filter/zlib.hpp>
21#include <boost/iostreams/filter/zstd.hpp>
22#include <boost/iostreams/filtering_stream.hpp>
23#include <boost/iostreams/stream.hpp>
24#include <boost/iostreams/stream_buffer.hpp>
36namespace datahandlinglibs {
42template<
class ReadoutType,
size_t Alignment = 4096>
48 boost::iostreams::filtering_stream<boost::iostreams::input, char, std::char_traits<char>,
aligned_allocator_t>;
82 void open(std::string
filename,
size_t buffer_size, std::string compression_algorithm =
"None")
93 io_source_t io_source(fd, boost::iostreams::file_descriptor_flags::close_handle);
95 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Using zstd compression" << std::endl;
98 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Using lzma compression" << std::endl;
101 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Using zlib compression" << std::endl;
104 TLOG_DEBUG(TLVL_WORK_STEPS) <<
"Running without compression" << std::endl;
127 bool read(ReadoutType& element)
131 m_input_stream.read(
reinterpret_cast<char*
>(&element),
sizeof(element));
BufferedFileReader & operator=(BufferedFileReader &&)=delete
BufferedFileReader is not move-assignable.
void open(std::string filename, size_t buffer_size, std::string compression_algorithm="None")
boost::iostreams::file_descriptor_source io_source_t
BufferedFileReader & operator=(const BufferedFileReader &)=delete
BufferedFileReader is not copy-assginable.
BufferedFileReader(const BufferedFileReader &)=delete
BufferedFileReader is not copy-constructible.
std::string m_compression_algorithm
filtering_istream_t m_input_stream
boost::iostreams::filtering_stream< boost::iostreams::input, char, std::char_traits< char >, aligned_allocator_t > filtering_istream_t
BufferedFileReader(std::string filename, size_t buffer_size, std::string compression_algorithm="None")
boost::alignment::aligned_allocator< io_source_t::char_type, Alignment > aligned_allocator_t
bool read(ReadoutType &element)
BufferedFileReader(BufferedFileReader &&)=delete
BufferedFileReader is not move-constructible.
#define TLOG_DEBUG(lvl,...)
SourceID[" << sourceid << "] Command daqdataformats::SourceID Readout Initialization std::string initerror BufferedReaderWriterConfigurationError