ATLAS Offline Software
Loading...
Searching...
No Matches
Decoration.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4#include "Acts/Utilities/HashedString.hpp"
6
7
8namespace ActsTrk::detail {
9
10template<typename T>
11bool build (const std::type_info* typeInfo, const std::string& name, std::vector<Decoration>& decorations){
12 if (*typeInfo == typeid(T)) {
13 decorations.emplace_back(
16 return true;
17 }
18 return false;
19}
20
21std::vector<Decoration> restoreDecorations(
23 const std::set<std::string>& staticVariables) {
24 std::vector<Decoration> decorations;
25 for (auto id : container->getAuxIDs()) {
26 const std::string name = SG::AuxTypeRegistry::instance().getName(id);
27 const std::type_info* typeInfo =
29 if (staticVariables.count(name) == 1) {
30 continue;
31 }
32
33 // try making decoration accessor of matching type
34 // there is a fixed set of supported types (as there is a fixed set
35 // available in MutableMTJ) setters are not needed so replaced by a
36 if ( build<float>(typeInfo, name, decorations) ||
37 build<double>(typeInfo, name, decorations) ||
38 build<short>(typeInfo, name, decorations) ||
39 build<int>(typeInfo, name, decorations) ||
40 build<uint8_t>(typeInfo, name, decorations) ||
41 build<uint16_t>(typeInfo, name, decorations) ||
42 build<uint32_t>(typeInfo, name, decorations) ||
43 build<uint64_t>(typeInfo, name, decorations) ||
44 build<int8_t>(typeInfo, name, decorations) ||
45 build<int16_t>(typeInfo, name, decorations) ||
46 build<int32_t>(typeInfo, name, decorations) ||
47 build<int64_t>(typeInfo, name, decorations)
48 ) {
49 continue;
50 }
51 throw std::runtime_error("Can't restore decoration of " + name +
52 " because it is of an unsupported type");
53 }
54 return decorations;
55}
56} // namespace ActsTrk::detail
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Interface for const operations on an auxiliary store.
Athena definition of the Eigen plugin.
void decorationCopier(SG::IAuxStore *dst, ActsTrk::IndexType dst_idx, SG::auxid_t decorationId, const std::any &src_ptr)
Definition Decoration.h:76
const std::any constDecorationGetter(const SG::IConstAuxStore *container, ActsTrk::IndexType idx, SG::auxid_t decorationId)
Definition Decoration.h:49
bool build(const std::type_info *typeInfo, const std::string &name, std::vector< Decoration > &decorations)
static Decoration decoration(std::string_view n, GetterType g, CopierType c, SetterType s=static_cast< SetterType >(nullptr))
Definition Decoration.h:83
std::vector< Decoration > restoreDecorations(const SG::IConstAuxStore *container, const std::set< std::string > &staticVariables)