Project
Loading...
Searching...
No Matches
DigitSink.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#ifndef O2_MCH_DEVIO_DIGITS_DIGIT_SINK_H
13#define O2_MCH_DEVIO_DIGITS_DIGIT_SINK_H
14
15#include <iosfwd>
16#include <gsl/span>
17#include "DigitFileFormat.h"
18#include <memory>
19#include <numeric>
20
21namespace o2::mch
22{
23class ROFRecord;
24class Digit;
25
26namespace io
27{
28namespace impl
29{
30class DigitSinkImpl;
31}
33{
34 public:
38 DigitSink(std::ostream& os);
39
46 DigitSink(std::ostream& os, DigitFileFormat format,
47 size_t maxSize = std::numeric_limits<size_t>::max());
48
49 /* defined in the implementation file, where mImpl is a complete type */
51
57 bool write(gsl::span<const Digit> digits,
58 gsl::span<const ROFRecord> rofs = {});
59
60 private:
61 std::ostream& mOutput; // underlying stream used for output
62 bool mBinary; // whether to output in binary mode or text mode
63 DigitFileFormat mFileFormat{}; // version information for the binary case
64 std::unique_ptr<impl::DigitSinkImpl> mImpl; // actual implementation of the writer
65 size_t mMaxSize; // max size written to output
66};
67} // namespace io
68} // namespace o2::mch
69
70#endif
bool write(gsl::span< const Digit > digits, gsl::span< const ROFRecord > rofs={})
GLint GLint GLsizei GLint GLenum format
Definition glcorearb.h:275
o2::cpv::Digit Digit
std::vector< Digit > digits