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();
164 std::pmr::memory_resource* ptr
ATLAS_THREAD_SAFE =
const_cast<std::pmr::memory_resource*
>( cptr );
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;
297 return m_store->isDecoration (auxid);
309 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
316 auxid_t linked_id =
r.linkedVariable( auxid );
325 std::cout <<
"ERROR xAOD::AuxContainerBase::getDecoration "
326 <<
"Can't provide variable "
365 bool anycleared =
false;
367 anycleared =
m_store->clearDecorations();
370 if (!anycleared)
return false;
381 ids.insert (
m_store->getAuxIDs());
393 m_store->lockDecoration (auxid);
401 auxid_t linked_id =
r.linkedVariable( auxid );
405 return m_vecs[ linked_id ];
418 auxid_t linked_id =
r.linkedVariable( auxid );
422 return m_vecs[ linked_id ];
425 return m_store->linkedVector( auxid );
470 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
477 auxid_t linked_id =
r.linkedVariable( auxid );
484 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
485 <<
"Unknown variable ("
487 <<
") requested" << std::endl;
491 m_vecs[ auxid ]->reserve( capacity );
496 return m_vecs[ auxid ]->toPtr();
520 if(v && !v->isLinked()) {
521 if (!v->resize(
size ))
547 if(v && !v->isLinked()) {
572 if(v && !v->isLinked()) {
573 v->shift( pos, offs );
598 size_t other_size =
other.size();
610 if (
other.getData (
id)) {
611 void* src_ptr =
other.getData (
id, other_size, other_size);
613 if (!v_dst->
insertMove (pos, src_ptr, 0, other_size,
619 const void* orig = v_dst->
toPtr();
620 v_dst->
shift (pos, other_size);
621 if (orig != v_dst->
toPtr())
645 return m_vecs[id]->setOption (option);
648 return m_store->setOption (
id, option);
667 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
671 std::cout <<
"ERROR xAOD::AuxContainerBase::getIOData "
672 <<
"Unknown variable ("
674 <<
") requested" << std::endl;
683 return m_vecs[ auxid ]->toVector();
692 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
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.
An auxiliary data store that holds data internally.
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 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.
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.