ATLAS Offline Software
Loading...
Searching...
No Matches
JaggedVecEltCache.h
Go to the documentation of this file.
1#ifndef XAOD_INDETMEASUREMENT_UTILITIES_JAGGEDVECELTCACHE_H
2#define XAOD_INDETMEASUREMENT_UTILITIES_JAGGEDVECELTCACHE_H
3
5
7template <typename T>
9public:
10 JaggedVecEltCache(SG::AuxVectorData& cont, const SG::Accessor<SG::JaggedVecElt<T> > &accessor, unsigned int n) {
11 if (n>0) {
12 assert(cont.getStore());
13 cont.getStore()->getData(accessor.linkedAuxid(),n, n);
14 m_elt = accessor.getEltSpan(cont);
15 m_payload = accessor.getPayloadSpan(cont);
16 }
17 }
18 unsigned int getBeginIndex(unsigned int obj_i) const {
19 assert(obj_i==0 || obj_i-1 < m_elt.size());
20 return obj_i>0 ? m_elt[obj_i-1].end() : 0u;
21 }
22 unsigned int getEndIndex(unsigned int obj_i) const {
23 assert(obj_i < m_elt.size());
24 return m_elt[obj_i].end();
25 }
26 void setValue(unsigned int elm_i, T &&value) {
27 assert(elm_i<m_payload.size());
28 m_payload[elm_i]=std::move(value);
29 }
30 void setValue(unsigned int elm_i, const T &value) {
31 assert(elm_i<m_payload.size());
32 m_payload[elm_i]=value;
33 }
34 void updateEndIndex(unsigned int obj_i, unsigned int elm_i) {
35 assert(elm_i<=m_payload.size());
36 assert(obj_i<m_elt.size());
37 m_elt[obj_i]=elm_i;
38 }
39 std::size_t nObjects() const { return m_elt.size(); };
40 std::size_t nElements() const { return m_payload.size(); };
41private:
44};
45}
46#endif
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Helper class to provide type-safe access to aux data.
Manage lookup of vectors of auxiliary data.
SG::IAuxStore * getStore()
Return the current store, as a non-const interface.
virtual void * getData(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data item.
Describe one element of a jagged vector.
unsigned int getEndIndex(unsigned int obj_i) const
void updateEndIndex(unsigned int obj_i, unsigned int elm_i)
SG::Accessor< SG::JaggedVecElt< T > >::Payload_span m_payload
unsigned int getBeginIndex(unsigned int obj_i) const
void setValue(unsigned int elm_i, const T &value)
SG::Accessor< SG::JaggedVecElt< T > >::Elt_span m_elt
JaggedVecEltCache(SG::AuxVectorData &cont, const SG::Accessor< SG::JaggedVecElt< T > > &accessor, unsigned int n)