Project
Loading...
Searching...
No Matches
DigitSamplerImpl.cxx
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#include "DigitSamplerImpl.h"
13#include <istream>
14#include "DigitFileFormat.h"
15#include <map>
16#include "DigitIOV0.h"
17#include "DigitIOV1.h"
18#include "DigitIOV2.h"
19#include "DigitIOV3.h"
20#include "DigitIOV4.h"
21#include <memory>
22
23namespace o2::mch::io::impl
24{
25
26std::unique_ptr<DigitSamplerImpl> createDigitSamplerImpl(int version)
27{
28 switch (version) {
29 case 0:
30 return std::make_unique<DigitSamplerV0>();
31 case 1:
32 return std::make_unique<DigitSamplerV1>();
33 case 2:
34 return std::make_unique<DigitSamplerV2>();
35 case 3:
36 return std::make_unique<DigitSamplerV3>();
37 case 4:
38 return std::make_unique<DigitSamplerV4>();
39 default:
40 break;
41 };
42 throw std::invalid_argument(fmt::format("DigitFileFormat version {} not implemented yet",
43 version));
44 return nullptr;
45}
46
47void DigitSamplerImpl::rewind(std::istream& in)
48{
49 in.clear();
50 in.seekg(sizeof(DigitFileFormat));
51}
52
53} // namespace o2::mch::io::impl
uint32_t version
Definition RawData.h:8
std::unique_ptr< DigitSamplerImpl > createDigitSamplerImpl(int version)