ATLAS Offline Software
Loading...
Searching...
No Matches
SpecRegistry.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
4#ifndef GLOBALSIM_SPECREGISTRY_H
5#define GLOBALSIM_SPECREGISTRY_H
6
7/*
8 Turns the name of a BitSpec into the pair of functions that pack and unpack
9 it. TOBTextReader and TOBTextWriter both take the name as a property and ask
10 for it here, so a TOB type becomes usable in both directions at once.
11
12 Which specs exist is not stated in this package's C++ any more. A spec becomes
13 usable by being listed in GlobalSimulation/selection.xml, which is also what
14 the dictionary is generated from; the functions are then built from the type
15 name through the ROOT interpreter the first time that name is asked for, and
16 kept. Adding a TOB type touches the header that defines it and the two files
17 next to it, and nothing here.
18
19 Keeping the layout behind a std::function means neither algorithm is a class
20 template: there is one component per algorithm however many specs exist, and
21 the spec is chosen at configuration time rather than at compile time.
22*/
23
25
26#include <cstddef>
27#include <functional>
28#include <string>
29
30namespace GlobalSim {
31
32 struct SpecEntry {
35 std::size_t width{0};
36
38 std::function<std::string(const SG::AuxElement&)> pack;
39
43 std::function<void(SG::AuxElement&, const std::string&)> unpack;
44 };
45
53 const SpecEntry* specEntry(const std::string& name, std::string& error);
54
56 std::string knownSpecNames();
57
58}
59
60#endif // GLOBALSIM_SPECREGISTRY_H
Base class for elements of a container that can have aux data.
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition BitSpec.h:24
const SpecEntry * specEntry(const std::string &name, std::string &error)
The entry for one spec, or nullptr if there is not one.
std::string knownSpecNames()
Comma-separated list of the names in the dictionary, for error messages.
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
std::size_t width
Total width of the packed word, in bits.
std::function< void(SG::AuxElement &, const std::string &)> unpack
Fill one object from its hex token.
std::function< std::string(const SG::AuxElement &)> pack
Pack one object into its hex token.