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 const IAuxTypeVectorgetVector (SG::auxid_t) const override
 Return vector interface 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 const SG::auxid_set_tgetDecorIDs () const override
 Return a set of identifiers for decorations 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 148 of file AuxStoreConstMem.cxx.

149 {
150  return false;
151 }

◆ 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 103 of file AuxStoreConstMem.cxx.

104 {
105  return m_auxids;
106 }

◆ 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 90 of file AuxStoreConstMem.cxx.

91 {
92  return nullptr;
93 }

◆ getDecorIDs()

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

Return a set of identifiers for decorations in this store.

Implements SG::IConstAuxStore.

Definition at line 112 of file AuxStoreConstMem.cxx.

113 {
114  static const auxid_set_t empty;
115  return empty;
116 }

◆ getVector()

const IAuxTypeVector * SG::AuxStoreConstMem::getVector ( SG::auxid_t  ) const
overridevirtual

Return vector interface for one aux data item.

Parameters
auxidThe identifier of the desired aux data item.

Unimplmented for this implementation.

Implements SG::IConstAuxStore.

Definition at line 74 of file AuxStoreConstMem.cxx.

75 {
76  std::abort();
77 }

◆ 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 125 of file AuxStoreConstMem.cxx.

126 {
127  return false;
128 }

◆ 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, xAOD::AuxInfoBase, and xAOD::RAuxStore.

Definition at line 189 of file IConstAuxStore.h.

190  { 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 138 of file AuxStoreConstMem.cxx.

139 {
140 }

◆ 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 171 of file AuxStoreConstMem.cxx.

172 {
173 }

◆ 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 159 of file AuxStoreConstMem.cxx.

160 {
161  return m_size;
162 }

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 161 of file AuxStoreConstMem.h.

◆ m_buffers

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

Definition at line 158 of file AuxStoreConstMem.h.

◆ m_size

size_t SG::AuxStoreConstMem::m_size
private

Definition at line 157 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:157
SG::AuxStoreConstMem::size
virtual size_t size() const override
Return the number of elements in the store.
Definition: AuxStoreConstMem.cxx:159
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
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:161
SG::AuxStoreConstMem::m_buffers
std::vector< const void * > m_buffers
Definition: AuxStoreConstMem.h:158