Project
Loading...
Searching...
No Matches
DigitSampler.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_READER_H
13#define O2_MCH_DEVIO_DIGITS_DIGIT_READER_H
14
15#include <iosfwd>
16#include "DigitFileFormat.h"
17#include <vector>
18#include <memory>
19
20namespace o2::mch
21{
22class Digit;
23class ROFRecord;
24} // namespace o2::mch
25
26namespace o2::mch::io
27{
28namespace impl
29{
30class DigitSamplerImpl;
31}
33{
34 public:
35 DigitSampler(std::istream& in);
36
37 /* defined in the implementation file, where mImpl is a complete type */
39
41 DigitFileFormat fileFormat() const { return mFileFormat; }
42
50 bool read(std::vector<Digit>& digits,
51 std::vector<ROFRecord>& rofs);
52
56 size_t nofTimeFrames() const;
57
61 size_t nofROFs() const;
62
66 size_t nofDigits() const;
67
69 void rewind();
70
71 private:
72 void count() const;
73
74 private:
75 std::istream& mInput;
76 DigitFileFormat mFileFormat;
77 std::unique_ptr<impl::DigitSamplerImpl> mImpl;
78 mutable size_t mNofTimeFrames{0};
79 mutable size_t mNofROFs{0};
80 mutable size_t mNofDigits{0};
81 mutable bool mCountDone{false};
82};
83
84} // namespace o2::mch::io
85
86#endif
DigitFileFormat fileFormat() const
bool read(std::vector< Digit > &digits, std::vector< ROFRecord > &rofs)
GLint GLsizei count
Definition glcorearb.h:399
o2::cpv::Digit Digit
std::vector< Digit > digits