Project
Loading...
Searching...
No Matches
VectorPadflagsCustomStreamer.cxx
Go to the documentation of this file.
1// Copyright 2019-2025 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
12using std::vector;
13
14void VectorPadFlagsStreamer(TBuffer& R__b, void* objp)
15{
16 std::vector<o2::tpc::PadFlags>* obj = static_cast<std::vector<o2::tpc::PadFlags>*>(objp);
17 if (R__b.IsReading()) {
18 std::vector<int> R__stl;
19 R__stl.clear();
20 int R__n;
21 R__b >> R__n;
22 R__stl.reserve(R__n);
23 for (int R__i = 0; R__i < R__n; R__i++) {
24 Int_t readtemp;
25 R__b >> readtemp;
26 R__stl.push_back(readtemp);
27 }
28 auto data = reinterpret_cast<unsigned short*>(R__stl.data());
29 for (int i = 0; i < R__n; ++i) {
30 obj->push_back(static_cast<o2::tpc::PadFlags>(data[i]));
31 }
32 } else {
33 // We always save things with the old format.
34 R__b << (int)obj->size() / 2;
35 for (size_t i = 0; i < obj->size(); i++) {
36 R__b << (short)obj->at(i);
37 }
38 }
39}
40
41#define RootStreamerLocal(name, STREAMER) \
42 namespace ROOT \
43 { \
44 \
45 \
46 static auto _R__UNIQUE_(R__dummyStreamer) = \
47 []() { TClass::GetClass<name>()->SetStreamerFunc(STREAMER); return 0; }(); \
48 \
49 R__UseDummy(_R__UNIQUE_(R__dummyStreamer)); \
50 }
51
52// Let's not try to fix the old ROOT version, so that we can build
53// the new ROOT with the patched code in the CI.
54#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 33, 00)
55RootStreamerLocal(vector<o2::tpc::PadFlags>, VectorPadFlagsStreamer);
56#endif
int32_t i
#define RootStreamerLocal(name, STREAMER)
void VectorPadFlagsStreamer(TBuffer &R__b, void *objp)
GLboolean * data
Definition glcorearb.h:298
PadFlags
Definition Defs.h:100