13#ifndef ATHCONTAINERS_AUXTYPEREGISTRY_H
14#define ATHCONTAINERS_AUXTYPEREGISTRY_H
21#ifndef XAOD_STANDALONE
28#include <unordered_map>
94 template <
class T,
class ALLOC = AuxAllocator_t<T> >
96 const std::string& clsname =
"",
97 const Flags flags = Flags::None,
116 const std::string& name,
117 const std::string& clsname =
"",
118 const Flags flags = Flags::None,
140 const std::type_info& ti,
141 const std::string& name,
142 const std::string& clsname =
"",
143 const Flags flags = Flags::None,
164 const std::type_info& ti,
165 const std::string& name,
166 const std::string& clsname =
"",
167 const Flags flags = Flags::None,
181 const std::string& clsname =
"")
const;
193 template <
class T,
class ALLOC = AuxAllocator_t<T> >
195 const Flags flags = Flags::None);
210 const std::type_info& ti,
211 const std::type_info& ti_alloc,
225 size_t capacity)
const;
430 const std::type_info& ti_alloc);
442 const std::string& alloc_name);
468 const std::type_info& ti_alloc,
469 std::unique_ptr<const IAuxTypeVectorFactory> factory);
485 const std::string& ti_alloc_name,
486 std::unique_ptr<const IAuxTypeVectorFactory> factory);
489#ifndef XAOD_STANDALONE
513 const std::string&
inputRename (
const std::string& key,
514 const std::string& name)
const;
527 static std::string
linkedName (
const std::string& name);
541 typedef AthContainers_detail::lock_guard<mutex_t>
lock_t;
571 template <
class T,
class ALLOC = AuxAllocator_t<T> >
589 static std::string
makeKey (
const std::string& name,
590 const std::string& clsname);
Factory object that creates vectors using AuxTypeVector.
Basic definitions for auxiliary types.
Interface for factory objects that create vectors.
Abstract interface for manipulating vectors of arbitrary types.
Abstract interface for looking up strings/CLIDs in a pool.
void clear()
Empty the pool.
Abstract interface for looking up strings/CLIDs in a pool.
@Brief Implementation class for AuxTypeRegistry.
Flags getFlags(SG::auxid_t auxid) const
Return flags associated with an auxiliary variable.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
SG::auxid_t getAuxID(const std::string &name, const std::string &clsname="", const Flags flags=Flags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
Look up a name -> auxid_t mapping.
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
static bool isLinkedName(const std::string &name)
Test if a variable name corresponds to a linked variable.
size_t getEltSize(SG::auxid_t auxid) const
Return size of an element in the STL vector.
std::unique_ptr< IAuxTypeVector > makeVectorFromData(SG::auxid_t auxid, void *data, IAuxTypeVector *linkedVector, bool isPacked, bool ownFlag) const
Construct an IAuxTypeVector object from a vector.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
const std::string & inputRename(const std::string &key, const std::string &name) const
Check for an input renaming of an auxiliary variable.
~AuxTypeRegistry()
Destructor.
std::string getTypeName(SG::auxid_t auxid) const
Return the type name of an aux data item.
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
friend class AuxTypeRegistryImpl
AuxTypeRegistry()
Constructor.
void copy(SG::auxid_t auxid, AuxVectorData &&dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
const std::type_info * getAllocType(SG::auxid_t auxid) const
Return the type of the vector allocator.
void checkAuxID(const SG::auxid_t auxid, const Flags flags=Flags::None)
Verify type for an aux variable.
std::unique_ptr< IAuxTypeVectorFactory > makeFactoryNull() const
makeFactory implementation that always returns nullptr.
void setInputRenameMap(const Athena::InputRenameMap_t *map, const IStringPool &pool)
Declare input renaming requests.
AthContainers_detail::mutex mutex_t
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
std::string getVecTypeName(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
AuxTypeRegistry & operator=(const AuxTypeRegistry &)
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
size_t numVariables() const
Return the total number of registered auxiliary variable.
SG::auxid_t linkedVariable(SG::auxid_t auxid) const
Return the auxid if the linked variable, if there is one.
static bool classNameHasLink(const std::string &className)
Test to see if a class name corresponds to a class with a linked variable.
AuxTypeRegistry(const AuxTypeRegistry &)
Disallow copy construction and assignment.
void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
const IAuxTypeVectorFactory * addFactory(const std::type_info &ti, const std::type_info &ti_alloc, std::unique_ptr< const IAuxTypeVectorFactory > factory)
Add a new type -> factory mapping.
std::unique_ptr< IAuxTypeVectorFactory > makeFactory() const
Create an AuxTypeVectorFactory instance.
AthContainers_detail::lock_guard< mutex_t > lock_t
SG::AuxVarFlags Flags
Additional flags to qualify an auxiliary variable.
void swap(SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const
Swap elements between vectors.
void copyForOutput(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Copy elements between vectors.
std::unique_ptr< IAuxTypeVector > makeVector(SG::auxid_t auxid, size_t size, size_t capacity) const
Construct a new vector to hold an aux item.
std::string getClassName(SG::auxid_t auxid) const
Return the class name associated with an aux data item (may be blank).
bool isLinked(SG::auxid_t auxid) const
Test whether this is a linked variable.
static std::string makeKey(const std::string &name, const std::string &clsname)
Return the key used to look up an entry in m_auxids.
Manage lookup of vectors of auxiliary data.
Interface for factory objects that create vectors.
Abstract interface for manipulating vectors of arbitrary types.
SG::SGKeyMap< InputRenameEntry > InputRenameMap_t
AuxVarFlags
Additional flags to qualify an auxiliary variable.
static const auxid_t null_auxid
To signal no aux data item.
SG::auxid_t auxid() const
Return the aux id for this variable.
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
virtual size_t size() const override
Return the number of elements in the store.
size_t auxid_t
Identifier for a particular aux data item.