|
ATLAS Offline Software
|
Go to the documentation of this file.
13 #ifndef ATHCONTAINERS_AUXTYPEREGISTRY_H
14 #define ATHCONTAINERS_AUXTYPEREGISTRY_H
25 #ifndef XAOD_STANDALONE
32 #include <unordered_map>
94 template <
class T,
class ALLOC = AuxAllocator_t<T> >
96 const std::string& clsname =
"",
114 const std::string&
name,
115 const std::string& clsname =
"",
134 const std::type_info& ti,
135 const std::string&
name,
136 const std::string& clsname =
"",
155 const std::type_info& ti,
156 const std::string&
name,
157 const std::string& clsname =
"",
171 const std::string& clsname =
"")
const;
183 template <
class T,
class ALLOC = AuxAllocator_t<T> >
200 const std::type_info& ti,
201 const std::type_info& ti_alloc,
215 size_t capacity)
const;
399 const std::type_info& ti_alloc);
411 const std::string& alloc_name);
437 const std::type_info& ti_alloc,
438 std::unique_ptr<const IAuxTypeVectorFactory> factory);
454 const std::string& ti_alloc_name,
455 std::unique_ptr<const IAuxTypeVectorFactory> factory);
458 #ifndef XAOD_STANDALONE
483 const std::string&
name)
const;
488 typedef AthContainers_detail::lock_guard<mutex_t>
lock_t;
536 const std::string& clsname,
538 const std::type_info& ti,
539 const std::type_info* ti_alloc,
540 const std::string* alloc_name,
558 const std::type_info& ti,
559 const std::type_info& ti_alloc,
577 const std::type_info& ti,
578 const std::string& ti_alloc_name,
579 std::unique_ptr<const IAuxTypeVectorFactory> factory);
591 template <
class T,
class ALLOC = AuxAllocator_t<T> >
609 static std::string
makeKey (
const std::string&
name,
610 const std::string& clsname);
634 const std::type_info& ti,
635 const std::type_info& ti_alloc);
642 AthContainers_detail::atomic<const IAuxTypeVectorFactory*>
m_factory;
664 bool checkAlloc (
const std::type_info* ti_alloc,
665 const std::string* alloc_name)
const;
671 AthContainers_detail::concurrent_vector<typeinfo_t>
m_types;
675 using id_map_t = CxxUtils::ConcurrentStrMap<SG::auxid_t, CxxUtils::SimpleUpdater>;
679 using ti_map_t = CxxUtils::ConcurrentStrMap<const IAuxTypeVectorFactory*, CxxUtils::SimpleUpdater>;
701 using allocMap_t = CxxUtils::ConcurrentStrMap<const std::type_info*, CxxUtils::SimpleUpdater>;
712 #endif // not ATHCONTAINERS_AUXTYPEREGISTRY_H
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
CxxUtils::ConcurrentStrMap< const std::type_info *, CxxUtils::SimpleUpdater > allocMap_t
char data[hepevt_bytes_allocation_ATLAS]
Abstract interface for looking up strings/CLIDs in a pool.
std::unique_ptr< IAuxTypeVector > makeVectorFromData(SG::auxid_t auxid, void *data, bool isPacked, bool ownFlag) const
Construct an IAuxTypeVector object from a vector.
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.
const std::type_info * m_ti_alloc
Type of the vector allocator. May be null for a dynamic type;.
SG::auxid_t getAuxID(const std::string &name, const std::string &clsname="", const Flags flags=Flags::None)
Look up a name -> auxid_t mapping.
std::vector< const IAuxTypeVectorFactory * > m_oldFactories
Hold additional factory instances we need to delete.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
void setInputRenameMap(const Athena::IInputRename::InputRenameMap_t *map, const IStringPool &pool)
Declare input renaming requests.
AthContainers_detail::lock_guard< mutex_t > lock_t
static std::string makeKey(const std::string &name, const std::string &clsname)
Return the key used to look up an entry in m_auxids.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Factory object that creates vectors using AuxTypeVector.
std::string getVecTypeName(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
Hash map from strings allowing concurrent, lockless reads.
const std::string & inputRename(const std::string &key, const std::string &name) const
Check for an input renaming of an auxiliary variable.
const std::type_info * getAllocType(SG::auxid_t auxid) const
Return the type of the vector allocator.
CxxUtils::ConcurrentStrMap< const IAuxTypeVectorFactory *, CxxUtils::SimpleUpdater > ti_map_t
Map from type_info name + allocator ti name -> IAuxTypeVectorFactory.
std::string m_clsname
Class name associated with this aux data item. May be blank.
const std::type_info * m_ti
Type of the aux data item.
AthContainers_detail::concurrent_vector< typeinfo_t > m_types
Table of aux data items, indexed by auxid.
AuxTypeRegistry()
Constructor.
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.
Abstract interface for manipulating vectors of arbitrary types.
~AuxTypeRegistry()
Destructor.
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.
Handle mappings between names and auxid_t.
AthContainers_detail::mutex mutex_t
std::string m_name
Aux data name.
size_t auxid_t
Identifier for a particular aux data item.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
void swap(SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const
Swap elements between vectors.
Abstract interface for looking up strings/CLIDs in a pool.
std::string getTypeName(SG::auxid_t auxid) const
Return the type name of an aux data item.
Flags m_flags
Additional type flags.
Interface for factory objects that create vectors.
Flags getFlags(SG::auxid_t auxid) const
Return flags associated with an auxiliary variable.
size_t getEltSize(SG::auxid_t auxid) const
Return size of an element in the STL vector.
std::unique_ptr< IAuxTypeVectorFactory > makeFactory() const
Create an AuxTypeVectorFactory instance.
const IAuxTypeVectorFactory * getFactory(SG::auxid_t auxid) const
Return the vector factory for a given auxid.
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.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
void clear(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, size_t n) const
Clear a range of elements within a vector.
std::string getClassName(SG::auxid_t auxid) const
Return the class name associated with an aux data item (may be blank).
Implementation of IAuxTypeVector for specific types.
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.
AthContainers_detail::atomic< const IAuxTypeVectorFactory * > m_factory
Factory object.
void checkAuxID(const SG::auxid_t auxid, const Flags flags=Flags::None)
Verify type for an aux variable.
Hold information about one aux data item.
mutex_t m_mutex
Mutex controlling access to the registry.
Basic definitions for auxiliary types.
static bool checkName(const std::string &s)
Check for valid variable name.
std::unique_ptr< IAuxTypeVectorFactory > makeFactoryNull() const
makeFactory implementation that always returns nullptr.
Simple (non-deleting) Updater implementation.
std::unordered_map< std::string, std::string > renameMap_t
Save the information provided by setInputRenameMap.
CxxUtils::ConcurrentStrMap< SG::auxid_t, CxxUtils::SimpleUpdater > id_map_t
Map from name -> auxid.
Interface for factory objects that create vectors.
std::string m_alloc_name
Name of the vector allocator.
AuxTypeRegistry & operator=(const AuxTypeRegistry &)
Manage lookup of vectors of auxiliary data.
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.
bool checkAlloc(const std::type_info *ti_alloc, const std::string *alloc_name) const
Check that the allocator type for this entry matches the requested type.