ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
SG::AuxStoreConstMem Class Reference

IConstAuxStore implementation referencing external buffers. More...

#include <AuxStoreConstMem.h>

Inheritance diagram for SG::AuxStoreConstMem:
Collaboration diagram for SG::AuxStoreConstMem:

Public Member Functions

 AuxStoreConstMem (size_t size)
 Constructor. More...
 
void addBuffer (SG::auxid_t auxid, const void *buf)
 Add a new, external buffer. More...
 
virtual const void * getData (SG::auxid_t auxid) const override
 Return the data vector for one aux data item. More...
 
virtual void * getDecoration (auxid_t auxid, size_t size, size_t capacity) override
 Return the data vector for one aux data decoration item. More...
 
virtual const SG::auxid_set_tgetAuxIDs () const override
 Return a set of identifiers for existing data items in this store. More...
 
virtual bool isDecoration (auxid_t auxid) const override
 Test if a particular variable is tagged as a decoration. More...
 
virtual void lock () override
 Lock the container. More...
 
virtual bool clearDecorations () override
 Clear all decorations. More...
 
virtual size_t size () const override
 Return the number of elements in the store. More...
 
virtual void lockDecoration (SG::auxid_t auxid) override
 Lock a decoration. More...
 
virtual const IAuxTypeVectorlinkedVector (SG::auxid_t) const
 Return interface for a linked variable. More...
 

Private Attributes

size_t m_size
 
std::vector< const void * > m_buffers
 
SG::auxid_set_t m_auxids
 Set of auxid's for which we've added a buffer. More...
 

Detailed Description

IConstAuxStore implementation referencing external buffers.

This is an implementation of IConstAuxStore that, rather than managing memory itself, simply holds references to buffers managed externally.

You need to specify the number of elements when you create the object. Then call addBuffer for each auxiliary variable to be managed, passing the auxid and the buffer.

This class assumes the managed data is strictly const, and hence makes no attempt to implement decorations.

Definition at line 36 of file AuxStoreConstMem.h.

Constructor & Destructor Documentation

◆ AuxStoreConstMem()

SG::AuxStoreConstMem::AuxStoreConstMem ( size_t  size)

Constructor.

Parameters
sizeThe number of elements in the container.

Definition at line 23 of file AuxStoreConstMem.cxx.

24  : m_size (size)
25 {
26 }

Member Function Documentation

◆ addBuffer()

void SG::AuxStoreConstMem::addBuffer ( SG::auxid_t  auxid,
const void *  buf 
)

Add a new, external buffer.

Parameters
auxidThe identifier of the aux data item.
bufPointer to the start of the buffer for the variable.

The actual type of the data pointed to must match the registered type of auxid; no checking is done.

This method is not compatible with any other accesses to this object in other threads.

Definition at line 40 of file AuxStoreConstMem.cxx.

41 {
42  if (m_buffers.size() <= auxid)
43  m_buffers.resize (auxid+1);
44  m_buffers[auxid] = buf;
45  m_auxids.insert (auxid);
46 }

◆ clearDecorations()

bool SG::AuxStoreConstMem::clearDecorations ( )
overridevirtual

Clear all decorations.

This is a no-op for this (const) class. Always returns false.

Implements SG::IConstAuxStore.

Definition at line 126 of file AuxStoreConstMem.cxx.

127 {
128  return false;
129 }

◆ getAuxIDs()

const SG::auxid_set_t & SG::AuxStoreConstMem::getAuxIDs ( ) const
overridevirtual

Return a set of identifiers for existing data items in this store.

This should include identifiers for all items, const and non-const.

Implements SG::IConstAuxStore.

Definition at line 91 of file AuxStoreConstMem.cxx.

92 {
93  return m_auxids;
94 }

◆ getData()

const void * SG::AuxStoreConstMem::getData ( SG::auxid_t  auxid) const
overridevirtual

Return the data vector for one aux data item.

Parameters
auxidThe identifier of the desired aux data item.

Each aux data item is stored as a vector, with one entry per entry in the owning container. This returns a pointer to the start of the vector.

This should return 0 if the item doesn't exist.

Implements SG::IConstAuxStore.

Definition at line 59 of file AuxStoreConstMem.cxx.

60 {
61  if (auxid < m_buffers.size()) {
62  return m_buffers[auxid];
63  }
64  return nullptr;
65 }

◆ getDecoration()

void * SG::AuxStoreConstMem::getDecoration ( auxid_t  auxid,
size_t  size,
size_t  capacity 
)
overridevirtual

Return the data vector for one aux data decoration item.

Parameters
auxidThe identifier of the desired aux data item.
sizeThe current size of the container (in case the data item does not already exist).
capacityThe current capacity of the container (in case the data item does not already exist).

This always returns null for this (const) class.

Implements SG::IConstAuxStore.

Definition at line 78 of file AuxStoreConstMem.cxx.

79 {
80  return nullptr;
81 }

◆ isDecoration()

bool SG::AuxStoreConstMem::isDecoration ( auxid_t  auxid) const
overridevirtual

Test if a particular variable is tagged as a decoration.

Parameters
auxidThe identifier of the desired aux data item.

This always returns false for this (const) class.

Implements SG::IConstAuxStore.

Definition at line 103 of file AuxStoreConstMem.cxx.

104 {
105  return false;
106 }

◆ linkedVector()

virtual const IAuxTypeVector* SG::IConstAuxStore::linkedVector ( SG::auxid_t  ) const
inlinevirtualinherited

Return interface for a linked variable.

Parameters
auxidThe ID of the parent variable.

If auxid has a linked variable, then return the IAuxTypeVector describing it. Otherwise, return nullptr. May return nullptr unconditionally if this store does not support linked variables.

Reimplemented in SG::AuxStoreInternal, xAOD::TAuxStore, xAOD::AuxContainerBase, and xAOD::AuxInfoBase.

Definition at line 174 of file IConstAuxStore.h.

175  { return nullptr; }

◆ lock()

void SG::AuxStoreConstMem::lock ( )
overridevirtual

Lock the container.

After this, only decorations can be changed/modified.

This is a no-op for this (const) class.

Implements SG::IConstAuxStore.

Definition at line 116 of file AuxStoreConstMem.cxx.

117 {
118 }

◆ lockDecoration()

void SG::AuxStoreConstMem::lockDecoration ( SG::auxid_t  auxid)
overridevirtual

Lock a decoration.

Parameters
auxidIdentifier of the decoration to lock.

This is a no-op for this (const) class.

Implements SG::IConstAuxStore.

Definition at line 149 of file AuxStoreConstMem.cxx.

150 {
151 }

◆ size()

size_t SG::AuxStoreConstMem::size ( ) const
overridevirtual

Return the number of elements in the store.

May return 0 for a store with no aux data.

Implements SG::IConstAuxStore.

Definition at line 137 of file AuxStoreConstMem.cxx.

138 {
139  return m_size;
140 }

Member Data Documentation

◆ m_auxids

SG::auxid_set_t SG::AuxStoreConstMem::m_auxids
private

Set of auxid's for which we've added a buffer.

Definition at line 146 of file AuxStoreConstMem.h.

◆ m_buffers

std::vector<const void*> SG::AuxStoreConstMem::m_buffers
private

Definition at line 143 of file AuxStoreConstMem.h.

◆ m_size

size_t SG::AuxStoreConstMem::m_size
private

Definition at line 142 of file AuxStoreConstMem.h.


The documentation for this class was generated from the following files:
SG::AuxStoreConstMem::m_size
size_t m_size
Definition: AuxStoreConstMem.h:142
SG::AuxStoreConstMem::size
virtual size_t size() const override
Return the number of elements in the store.
Definition: AuxStoreConstMem.cxx:137
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
CxxUtils::ConcurrentBitset::insert
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
SG::AuxStoreConstMem::m_auxids
SG::auxid_set_t m_auxids
Set of auxid's for which we've added a buffer.
Definition: AuxStoreConstMem.h:146
SG::AuxStoreConstMem::m_buffers
std::vector< const void * > m_buffers
Definition: AuxStoreConstMem.h:143