17#ifndef XAOD_STANDALONE
18# include "GaudiKernel/ThreadLocalContext.h"
27#include <memory_resource>
38 bool allowDynamicVars )
46 if( allowDynamicVars ) {
65 m_memResource( parent.m_memResource )
68 guard_t guard( parent.m_mutex );
72 if( parent.m_store ) {
104 std::vector< SG::IAuxTypeVector* >::iterator itr =
m_vecs.begin();
105 std::vector< SG::IAuxTypeVector* >::iterator end =
m_vecs.end();
106 for( ; itr != end; ++itr ) {
107 if( ! *itr )
continue;
124 if(
this == &rhs )
return *
this;
163 const std::pmr::memory_resource*
cptr = m_memResource.get();
166#ifndef XAOD_STANDALONE
167 const EventContext& ctx = Gaudi::Hive::currentContext();
174 ptr = std::pmr::get_default_resource();
177 m_memResource.set( ptr );
246 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
252 auxids_nc.insert( auxid );
254 auxid_t linked_id =
r.linkedVariable( auxid );
256 auxids_nc.insert( linked_id );
261 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
262 <<
"Unknown variable ("
264 <<
") requested" << std::endl;
302 return m_store->isDecoration (auxid);
314 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
317 void* result =
m_store->getDecoration( auxid,
size, capacity );
321 auxid_t linked_id =
r.linkedVariable( auxid );
330 std::cout <<
"ERROR xAOD::AuxContainerBase::getDecoration "
331 <<
"Can't provide variable "
370 bool anycleared =
false;
372 anycleared =
m_store->clearDecorations();
375 if (!anycleared)
return false;
386 ids.insert (
m_store->getAuxIDs());
398 m_store->lockDecoration (auxid);
406 auxid_t linked_id =
r.linkedVariable( auxid );
410 return m_vecs[ linked_id ];
423 auxid_t linked_id =
r.linkedVariable( auxid );
427 return m_vecs[ linked_id ];
430 return m_store->linkedVector( auxid );
444 v->toTransient( ctx );
493 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
496 void* result =
m_store->getData( auxid,
size, capacity );
500 auxid_t linked_id =
r.linkedVariable( auxid );
507 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
508 <<
"Unknown variable ("
510 <<
") requested" << std::endl;
514 m_vecs[ auxid ]->reserve( capacity );
519 return m_vecs[ auxid ]->toPtr();
543 if(v && !v->isLinked()) {
544 if (!v->resize(
size ))
570 if(v && !v->isLinked()) {
595 if(v && !v->isLinked()) {
596 v->shift( pos, offs );
621 size_t other_size =
other.size();
633 if (
other.getData (
id)) {
634 void* src_ptr =
other.getData (
id, other_size, other_size);
636 if (!v_dst->
insertMove (pos, src_ptr, 0, other_size,
642 const void* orig = v_dst->
toPtr();
643 v_dst->
shift (pos, other_size);
644 if (orig != v_dst->
toPtr())
668 return m_vecs[id]->setOption (option);
671 return m_store->setOption (
id, option);
690 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
694 std::cout <<
"ERROR xAOD::AuxContainerBase::getIOData "
695 <<
"Unknown variable ("
697 <<
") requested" << std::endl;
706 return m_vecs[ auxid ]->toVector();
715 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
ElementConstPointer cptr() const
Return a pointer to the referenced element.
An auxiliary data store that holds data internally.
Handle mappings between names and auxid_t.
Exceptions that can be thrown from AthContainers.
static const Attributes_t empty
Helper for getting a const version of a pointer.
Define macros for attributes used to control the static checker.
Hold information about an option setting request.
Handle mappings between names and auxid_t.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Exception — Attempted to modify auxiliary data in a locked store.
Interface providing I/O for a generic auxiliary store.
Interface for non-const operations on an auxiliary store.
Abstract interface for manipulating vectors of arbitrary types.
bool isLinked() const
Return true if this variable is linked from another one.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
A set of aux data identifiers.
Common base class for the auxiliary containers.
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
void setName(const char *name)
Set the name of the container instance.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
Memory resource to use for this container.
bool m_locked
Has the container been locked?
virtual SG::auxid_set_t getCopyIDs(bool warnUnlocked=false) const override
Get the set of variables that we should deep copy.
virtual void toTransient(const EventContext &ctx) override
Perform processing on aux variable objects just after reading to make them usable as transient object...
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
virtual size_t size() const override
Get the size of the container.
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
AuxContainerBase(bool allowDynamicVars=true)
Default constructor.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing).
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
AthContainers_detail::lock_guard< mutex_t > guard_t
std::string m_name
Name of the container in memory. Set externally.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
virtual void lock() override
Lock the container.
std::pmr::memory_resource * memResource()
Return the memory resource to use.
~AuxContainerBase()
Destructor.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
auxid_set_t m_auxids
Internal list of all available variables.
virtual const std::type_info * getIOType(auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
const char * name() const
Get the name of the container instance.
virtual bool clearDecorations() override
Clear all decorations.
SG::auxid_t auxid_t
The aux ID type definition.
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
AuxContainerBase & operator=(const AuxContainerBase &rhs)
Assignment operator.
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
static const auxid_t null_auxid
To signal no aux data item.
virtual SG::auxid_set_t getCopyIDs(bool warnUnlocked=false) const override
Return the set of variables to copy in a deep copy.
AuxStoreInternal(bool standalone=false)
An auxiliary data store that holds data internally.
size_t auxid_t
Identifier for a particular aux data item.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.