|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include <memory_resource>
19 #ifndef XAOD_STANDALONE
20 # include "GaudiKernel/ThreadLocalContext.h"
22 #endif // not XAOD_STANDALONE
31 AuxContainerBase::AuxContainerBase(
bool allowDynamicVars )
36 bool allowDynamicVars )
38 m_auxids(), m_vecs(), m_store( nullptr ), m_storeIO( nullptr ),
42 m_memResource( memResource ){
44 if( allowDynamicVars ) {
60 m_auxids(), m_vecs(), m_store( nullptr ), m_storeIO( nullptr ),
63 m_memResource(
parent.m_memResource )
85 std::pmr::memory_resource* memResource )
89 m_storeIO( nullptr ), m_ownsStore( false ),
92 m_memResource( memResource ){
104 for( ; itr !=
end; ++itr ) {
105 if( ! *itr )
continue;
122 if(
this == &rhs )
return *
this;
161 const std::pmr::memory_resource* cptr = m_memResource.get();
162 std::pmr::memory_resource*
ptr ATLAS_THREAD_SAFE =
const_cast<std::pmr::memory_resource*
>( cptr );
164 #ifndef XAOD_STANDALONE
165 const EventContext& ctx = Gaudi::Hive::currentContext();
172 ptr = std::pmr::get_default_resource();
175 m_memResource.set(
ptr );
244 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
250 auxids_nc.
insert( auxid );
252 auxid_t linked_id =
r.linkedVariable( auxid );
253 if (linked_id != SG::null_auxid) {
254 auxids_nc.insert( linked_id );
259 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
260 <<
"Unknown variable ("
262 <<
") requested" << std::endl;
307 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
314 auxid_t linked_id =
r.linkedVariable( auxid );
315 if (linked_id != SG::null_auxid) {
323 std::cout <<
"ERROR xAOD::AuxContainerBase::getDecoration "
324 <<
"Can't provide variable "
363 bool anycleared =
false;
368 if (!anycleared)
return false;
399 auxid_t linked_id =
r.linkedVariable( auxid );
400 if (linked_id != SG::null_auxid) {
403 return m_vecs[ linked_id ];
416 auxid_t linked_id =
r.linkedVariable( auxid );
417 if (linked_id != SG::null_auxid) {
420 return m_vecs[ linked_id ];
468 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
475 auxid_t linked_id =
r.linkedVariable( auxid );
476 if (linked_id != SG::null_auxid) {
482 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
483 <<
"Unknown variable ("
485 <<
") requested" << std::endl;
489 m_vecs[ auxid ]->reserve( capacity );
494 return m_vecs[ auxid ]->toPtr();
518 if(
v && !
v->isLinked()) {
519 if (!
v->resize(
size ))
545 if(
v && !
v->isLinked()) {
570 if(
v && !
v->isLinked()) {
571 v->shift(
pos, offs );
596 size_t other_size =
other.size();
608 if (
other.getData (
id)) {
609 void* src_ptr =
other.getData (
id, other_size, other_size);
617 const void* orig = v_dst->
toPtr();
619 if (orig != v_dst->
toPtr())
643 return m_vecs[
id]->setOption (option);
665 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
669 std::cout <<
"ERROR xAOD::AuxContainerBase::getIOData "
670 <<
"Unknown variable ("
672 <<
") requested" << std::endl;
681 return m_vecs[ auxid ]->toVector();
690 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
JetConstituentVector::iterator iterator
std::string m_name
Name of the container in memory. Set externally.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
virtual void lock() override
Lock the container.
bool isLinked() const
Return true if this variable is linked from another one.
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
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.
const char * name() const
Get the name of the container instance.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t())=0
Move all elements from other to this store.
virtual void lockDecoration(SG::auxid_t auxid)=0
Lock a decoration.
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const =0
Return vector interface for one aux data item.
virtual bool clearDecorations() override
Clear all decorations.
ReadStats & stats()
Access the object belonging to the current thread.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
std::pmr::memory_resource * memResource()
Return the memory resource to use.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
AuxContainerBase & operator=(const AuxContainerBase &rhs)
Assignment operator.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Exception — Attempted to modify auxiliary data in a locked store.
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
Exceptions that can be thrown from AthContainers.
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
Helper for getting a const version of a pointer.
Common base class for the auxiliary containers.
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.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
virtual size_t size() const =0
Return the number of elements in the store.
virtual void shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the container.
virtual IAuxTypeVector * linkedVector(SG::auxid_t)
~AuxContainerBase()
Destructor.
Interface providing I/O for a generic auxiliary store.
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
Handle mappings between names and auxid_t.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
virtual size_t size() const override
Get the size of the container.
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
virtual bool setOption(auxid_t, const AuxDataOption &)
Set an option for a given auxiliary variable.
size_t auxid_t
Identifier for a particular aux data item.
virtual bool clearDecorations()=0
Clear all decorations.
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
auxid_set_t m_auxids
Internal list of all available variables.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data decoration item.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
static IOStats & instance()
Singleton object accessor.
Hold information about an option setting request.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing)
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
SG::auxid_t auxid_t
The aux ID type definition.
Interface for non-const operations on an auxiliary store.
An auxiliary data store that holds data internally.
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
Memory resource to use for this container.
virtual void * getData(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data item.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
bool m_locked
Has the container been locked?
Abstract interface for manipulating vectors of arbitrary types.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
virtual const SG::auxid_set_t & getDecorIDs() const =0
Return a set of identifiers for decorations in this store.
Handle mappings between names and auxid_t.
virtual void lock()=0
Lock the container.
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
AuxContainerBase(bool allowDynamicVars=true)
Default constructor.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
virtual bool resize(size_t sz)=0
Change the size of all aux data vectors.
A set of aux data identifiers.
void setName(const char *name)
Set the name of the container instance.
virtual bool isDecoration(auxid_t auxid) const =0
Test if a particular variable is tagged as a decoration.
Define macros for attributes used to control the static checker.
An auxiliary data store that holds data internally.
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual void reserve(size_t sz)=0
Change the capacity of all aux data vectors.