ATLAS Offline Software
Loading...
Searching...
No Matches
SpecRegistry.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
4#include "SpecRegistry.h"
5
9
12
13namespace GlobalSim {
14
15 namespace {
16
17 // Both directions for one spec. This is the only templated code left in
18 // the text I/O: everything above it works through SpecEntry.
19 template<class Spec>
20 SpecEntry entryFor() {
21 return {
22 Spec::width,
23
24 [](const SG::AuxElement& tob) {
25 return binStrToHexStr(Object<Spec>(tob).bits().to_string());
26 },
27
28 [](SG::AuxElement& tob, const std::string& token) {
29 Object<Spec> obj(tob);
30 obj = typename Spec::bitset_type(hexStrToBinStr(token));
31 }};
32 }
33
34 } // anonymous namespace
35
36 const std::map<std::string, SpecEntry>& specRegistry() {
37 // Function-local so that it is built on first use, rather than during
38 // static initialisation where the order across translation units is
39 // not defined.
40 //
41 // ---- Adding a TOB type: one line here, and nothing else. ----
42 static const std::map<std::string, SpecEntry> specs = {
43 {"topoc_pu_type", entryFor<topoc_pu_type>()},
44 {"main_output_type", entryFor<main_output_type>()},
45 };
46 return specs;
47 }
48
49 std::string knownSpecNames() {
50 std::string names;
51 for (const auto& spec : specRegistry()) {
52 if (not names.empty()) { names += ", "; }
53 names += spec.first;
54 }
55 return names;
56 }
57
58}
static std::string to_string(const std::vector< T > &v)
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition BitSpec.h:23
std::string hexStrToBinStr(std::string s)
std::string knownSpecNames()
Comma-separated list of the known names, for error messages.
const std::map< std::string, SpecEntry > & specRegistry()
The known specs, by name. Built on first use.
std::string binStrToHexStr(std::string_view s)
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.