ATLAS Offline Software
Loading...
Searching...
No Matches
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.
void addBuffer (SG::auxid_t auxid, const void *buf)
 Add a new, external buffer.
virtual const void * getData (SG::auxid_t auxid) const override
 Return the data vector for one aux data item.
virtual const IAuxTypeVectorgetVector (SG::auxid_t) const override
 Return vector interface for one aux data item.
virtual void * getDecoration (auxid_t auxid, size_t size, size_t capacity) override
 Return the data vector for one aux data decoration item.
virtual const SG::auxid_set_tgetAuxIDs () const override
 Return a set of identifiers for existing data items in this store.
virtual const SG::auxid_set_tgetDecorIDs () const override
 Return a set of identifiers for decorations in this store.
virtual SG::auxid_set_t getCopyIDs (bool warnUnlocked=false) const override
 Return the set of variables to copy in a deep copy.
virtual bool isDecoration (auxid_t auxid) const override
 Test if a particular variable is tagged as a decoration.
virtual void lock () override
 Lock the container.
virtual bool clearDecorations () override
 Clear all decorations.
virtual size_t size () const override
 Return the number of elements in the store.
virtual void lockDecoration (SG::auxid_t auxid) override
 Lock a decoration.

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.

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}
virtual size_t size() const override
Return the number of elements in the store.

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);
45 m_auxids.insert (auxid);
46}
SG::auxid_set_t m_auxids
Set of auxid's for which we've added a buffer.
std::vector< const void * > m_buffers
SG::auxid_t auxid() const
Return the aux id for this variable.

◆ clearDecorations()

bool SG::AuxStoreConstMem::clearDecorations ( )
overridevirtual

Clear all decorations.

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

Definition at line 162 of file AuxStoreConstMem.cxx.

163{
164 return false;
165}

◆ 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.

Definition at line 103 of file AuxStoreConstMem.cxx.

104{
105 return m_auxids;
106}

◆ getCopyIDs()

SG::auxid_set_t SG::AuxStoreConstMem::getCopyIDs ( bool warnUnlocked = false) const
overridevirtual

Return the set of variables to copy in a deep copy.

Parameters
warnUnlockedIf true, we warn about variables skipped on account of being decorations.

This just returns getAuxIDs().

Definition at line 127 of file AuxStoreConstMem.cxx.

128{
129 return m_auxids;
130}

◆ 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.

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.

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.

Definition at line 112 of file AuxStoreConstMem.cxx.

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

◆ 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.

Unimplemented for this implementation.

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.

Definition at line 139 of file AuxStoreConstMem.cxx.

140{
141 return false;
142}

◆ 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.

Definition at line 152 of file AuxStoreConstMem.cxx.

153{
154}

◆ 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.

Definition at line 185 of file AuxStoreConstMem.cxx.

186{
187}

◆ 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.

Definition at line 173 of file AuxStoreConstMem.cxx.

174{
175 return m_size;
176}

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

◆ m_buffers

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

Definition at line 169 of file AuxStoreConstMem.h.

◆ m_size

size_t SG::AuxStoreConstMem::m_size
private

Definition at line 168 of file AuxStoreConstMem.h.


The documentation for this class was generated from the following files: