Project
Loading...
Searching...
No Matches
SerializationMethods.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#ifndef O2_FRAMEWORK_SERIALIZATIONMETHODS_H_
12#define O2_FRAMEWORK_SERIALIZATIONMETHODS_H_
13
16
18#include <TClass.h>
19
20namespace o2::framework
21{
22
46template <typename T, typename HintType = void>
47 requires(!std::is_pointer_v<T> && (std::same_as<HintType, const char> ||
48 std::same_as<HintType, TClass> ||
49 std::is_void_v<HintType>))
51{
52 public:
54 using wrapped_type = T;
55 using hint_type = HintType;
56
57 ROOTSerialized() = delete;
58 ROOTSerialized(wrapped_type& ref, hint_type* hint = nullptr) : mRef(ref), mHint(hint) {}
59
60 T& operator()() { return mRef; }
61 T const& operator()() const { return mRef; }
62
63 hint_type* getHint() const { return mHint; }
64
65 private:
66 wrapped_type& mRef;
67 hint_type* mHint; // optional hint e.g. class info or class name
68};
69
70template <typename T, typename HintType = void>
71 requires(!std::is_pointer_v<T> && (std::same_as<HintType, const char> ||
72 std::same_as<HintType, TClass> ||
73 std::is_void_v<HintType>))
75{
76 public:
78 using wrapped_type = T;
79 using hint_type = HintType;
80
81 CCDBSerialized() = delete;
82 CCDBSerialized(wrapped_type& ref, hint_type* hint = nullptr) : mRef(ref), mHint(hint) {}
83
84 T& operator()() { return mRef; }
85 T const& operator()() const { return mRef; }
86
87 hint_type* getHint() const { return mHint; }
88
89 private:
90 wrapped_type& mRef;
91 hint_type* mHint; // optional hint e.g. class info or class name
92};
93
94} // namespace o2::framework
95#endif // O2_FRAMEWORK_SERIALIZATIONMETHODS_H_
CCDBSerialized(wrapped_type &ref, hint_type *hint=nullptr)
ROOTSerialized(wrapped_type &ref, hint_type *hint=nullptr)
Defining PrimaryVertex explicitly as messageable.