57 size_t size = other.m_vecs.size();
59 for (
size_t i = 0; i <
size; i++) {
61 m_vecs[i] = other.m_vecs[i]->clone();
112 return m_vecs[auxid].get();
155 if (
m_vecs.size() <= auxid) {
160 if (
m_vecs[auxid]) std::abort();
163 if (!
vec->isLinked()) {
165 if (vec->size() <
sz)
176 std::atomic_thread_fence (std::memory_order_seq_cst);
207 if (
m_vecs.size() <= auxid) {
212 std::unique_ptr<IAuxTypeVector> linked =
m_vecs[auxid]->linkedVector();
215 linked_id = linked->auxid();
216 m_vecs[linked_id] = std::move (linked);
225 std::atomic_thread_fence (std::memory_order_seq_cst);
235 return m_vecs[auxid]->toPtr();
264 if (v && !v->isLinked()) {
286 for (std::unique_ptr<IAuxTypeVector>& v :
m_vecs) {
287 if (v && !v->isLinked())
320 for (std::unique_ptr<IAuxTypeVector>& v :
m_vecs) {
321 if (v && !v->isLinked())
322 v->shift (pos, offs);
356 size_t other_size = other.size();
365 if (other.getData (
id)) {
366 void* src_ptr = other.getData (
id, other_size, other_size);
368 if (!v_dst->
insertMove (pos, src_ptr, 0, other_size,
374 const void* orig = v_dst->
toPtr();
375 v_dst->
shift (pos, other_size);
376 if (orig != v_dst->
toPtr())
384 if (!
m_auxids.test(
id) && !ignore.test(
id))
386 if (
r.isLinked (
id))
continue;
387 if (other.getData (
id)) {
388 void* src_ptr = other.getData (
id, other_size, other_size);
391 if (
sz < other_size)
sz = other_size + pos;
393 v->resize (
sz - other_size);
394 (void)v->insertMove (pos, src_ptr, 0, other_size,
469 std::ostringstream
ss;
470 ss <<
"Requested variable "
472 <<
" (" << auxid <<
") doesn't exist";
480 return m_vecs[auxid]->toPtr();
482 return m_vecs[auxid]->toVector();
502 std::ostringstream
ss;
503 ss <<
"Requested variable "
505 <<
" (" << auxid <<
") doesn't exist";
513 return m_vecs[auxid]->toPtr();
515 return m_vecs[auxid]->toVector();
550 if (!
r.isLinked (auxid))
551 return r.getType (auxid);
555 const std::type_info* ret =
m_vecs[auxid]->objType();
598 bool anycleared =
false;
634 return m_vecs[id]->size();
674 std::unique_ptr<IAuxTypeVector> packed =
m_vecs[id]->toPacked();
677 m_vecs[id] = std::move (packed);
678 return m_vecs[id]->setOption (option);
703 if (
m_vecs.size() <= auxid) {
710 m_vecs[auxid] =
r.makeVector (auxid,
size, capacity);
712 std::unique_ptr<IAuxTypeVector> linked =
m_vecs[auxid]->linkedVector();
714 auxid_t linked_id = linked->auxid();
715 m_vecs[linked_id] = std::move (linked);
725 m_vecs[auxid]->reserve (capacity);
728 return m_vecs[auxid].get();
786 auxid_t linked_id =
r.linkedVariable (auxid);
788 if (linked_id <
m_vecs.size())
789 return m_vecs[linked_id].get();
806 auxid_t linked_id =
r.linkedVariable (auxid);
808 if (linked_id <
m_vecs.size())
809 return m_vecs[linked_id].get();
An auxiliary data store that holds data internally.
Handle mappings between names and auxid_t.
std::vector< size_t > vec
Exceptions that can be thrown from AthContainers.
Describe how the contents of a PackedContainer are to be saved.
Hold information about an option setting request.
virtual void * getDataInternal(SG::auxid_t auxid, size_t size, size_t capacity, bool no_lock_check)
Return the data vector for one aux data item.
virtual bool setOption(auxid_t id, const AuxDataOption &option) override
Set an option for an auxiliary data variable.
bool standalone() const
Return the standalone flag.
bool m_locked
Has this container been locked?
virtual const void * getData(SG::auxid_t auxid) const override
Return the data vector for one aux data item.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
virtual IAuxTypeVector * getVectorInternal_noLock(SG::auxid_t auxid, size_t size, size_t capacity, bool no_lock_check)
Implementation of getVectorInternal; no locking.
const void * getIODataInternal(auxid_t auxid, bool quiet) const
Return a pointer to the data to be stored for one aux data item.
virtual const SG::auxid_set_t & getDynamicAuxIDs() const override
Get the list of all variables that need to be handled.
virtual bool resize(size_t sz) override
Change the size of all aux data vectors.
std::vector< std::unique_ptr< IAuxTypeVector > > m_vecs
The collection of vectors of aux data that we're managing, indexed by auxid.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
SG::auxid_set_t m_decorations
Record which variables are decorations.
virtual const SG::auxid_set_t & getAuxIDs() const override
Return a set of identifiers for existing data items in this store.
virtual bool isDecoration(auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
SG::auxid_set_t m_auxids
Set of auxid's for which we've created a vector.
virtual const SG::auxid_set_t & getWritableAuxIDs() const override
Return a set of identifiers for writable data items in this store.
void addVector(std::unique_ptr< IAuxTypeVector > vec, bool isDecoration)
Explicitly add a vector to the store.
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
size_t size_noLock() const
Return the number of elements in the store; no locking.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t(0)) override
Move all elements from other to this store.
virtual size_t size() const override
Return the number of elements in the store.
virtual ~AuxStoreInternal()
Destructor.
virtual const SG::auxid_set_t & getDecorIDs() const override
Return a set of identifiers for decorations in this store.
virtual void reserve(size_t sz) override
Change the capacity of all aux data vectors.
virtual bool clearDecorations() override
Clear all decorations.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
virtual void lock() override
Lock the container.
AuxStoreInternal(bool standalone=false)
Constructor.
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
void addAuxID(auxid_t auxid)
Add a new auxid to the set of those being managed by this store.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.
virtual const void * getIOData(SG::auxid_t auxid) const override
Return a pointer to the data to be stored for one aux data item.
bool m_standalone
Are we being written in standalone mode?
AthContainers_detail::lock_guard< mutex_t > guard_t
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.
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.
Exception — Attempted to modify auxiliary data in a locked 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.
static bool isValidOption(const AuxDataOption &option)
Test to see if option is a recognized packing option.
A set of aux data identifiers.
bool exists(const std::string &filename)
does a file exist
Helper for emitting error messages.
#define ATHCONTAINERS_ERROR(ctx, msg)
static const auxid_t null_auxid
To signal no aux data item.
size_t auxid_t
Identifier for a particular aux data item.