Project
Loading...
Searching...
No Matches
CompStream.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12/* Local Variables: */
13/* mode: c++ */
14/* End: */
15
16#ifndef COMPSTREAM_H
17#define COMPSTREAM_H
18
23
24#include <istream>
25#include <fstream>
26#include <ostream>
27#include <string>
28#include <boost/iostreams/filtering_streambuf.hpp>
29
30namespace o2
31{
32namespace io
33{
34
36 None,
37 Gzip,
38 Zlib,
39 Bzip2,
40 Lzma
41};
42
54class icomp_stream : public std::istream
55{
56 public:
57 using streambuffer_t = boost::iostreams::filtering_streambuf<boost::iostreams::input>;
58
63
67 icomp_stream(std::istream& backend, CompressionMethod method = CompressionMethod::None);
68
72 icomp_stream(std::string filename, std::string method);
73
77 icomp_stream(std::istream& backend, std::string method);
78
79 private:
80 streambuffer_t mStreamBuffer;
81 std::ifstream mInputFile;
82};
83
95class ocomp_stream : public std::ostream
96{
97 public:
98 using streambuffer_t = boost::iostreams::filtering_streambuf<boost::iostreams::output>;
99
104
108 ocomp_stream(std::ostream& backend, CompressionMethod method = CompressionMethod::None);
109
113 ocomp_stream(std::string filename, std::string method);
114
118 ocomp_stream(std::ostream& backend, std::string method);
119
120 private:
121 streambuffer_t mStreamBuffer;
122};
123
124} // namespace io
125} // namespace o2
126#endif // COMPSTREAM_H
boost::iostreams::filtering_streambuf< boost::iostreams::input > streambuffer_t
Definition CompStream.h:57
boost::iostreams::filtering_streambuf< boost::iostreams::output > streambuffer_t
Definition CompStream.h:98
CompressionMethod
Definition CompStream.h:35
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()