ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Attributes | Friends | List of all members
SG::JaggedVecEltBase Class Reference

Describe one element of a jagged vector (base class). More...

#include <JaggedVecImpl.h>

Inheritance diagram for SG::JaggedVecEltBase:
Collaboration diagram for SG::JaggedVecEltBase:

Classes

struct  Shift
 Helper to shift indices. More...
 

Public Types

using index_type = uint32_t
 Type for the indices. More...
 

Public Member Functions

 JaggedVecEltBase ()=default
 Default constructor. More...
 
 JaggedVecEltBase (index_type end)
 Constructor. More...
 
index_type begin (size_t elt_ndx) const
 Return the index of the beginning of the range. More...
 
index_type end () const
 Return the index of the end of the range. More...
 
size_t size (size_t elt_ndx) const
 Return the number of items in this range. More...
 
bool operator== (const JaggedVecEltBase &other) const
 Equality test. More...
 

Private Attributes

index_type m_end = 0
 End index. More...
 

Friends

struct Shift
 

Detailed Description

Describe one element of a jagged vector (base class).

Each jagged vector element holds its end index into the linked payload vector. The begin index is given by the end index of the previous element. Thus, these elements must be allocated as a contiguous vector. Further, in order to get the begin index, we need to know the index of this element object within its vector — because we have to special-case the first element.

For example, if we have a jagged vector with three elements of sizes 3, 1, 2, then what we would store is {3, 4, 6}.

This implies that one cannot interpret a JaggedVecElt in isolation (or a range of them); we need to know where they are stored in the xAOD variable vector. Fortunately, that's not something that is typically done, since jagged vectors are accessed via the specialized Accessor classes.

This non-templated base class holds the actual data. However, users should use the JaggedVecElt<PAYLOAD> derived types, to allow specifying the payload type.

Definition at line 51 of file JaggedVecImpl.h.

Member Typedef Documentation

◆ index_type

Type for the indices.

16 bits is probably too small, 64 bits is pretty definitely too large. Use 32.

Definition at line 56 of file JaggedVecImpl.h.

Constructor & Destructor Documentation

◆ JaggedVecEltBase() [1/2]

SG::JaggedVecEltBase::JaggedVecEltBase ( )
default

Default constructor.

Makes a null range.

◆ JaggedVecEltBase() [2/2]

SG::JaggedVecEltBase::JaggedVecEltBase ( index_type  end)

Constructor.

Parameters
begIndex of the start of the range.
endIndex of the end of the range.

Member Function Documentation

◆ begin()

index_type SG::JaggedVecEltBase::begin ( size_t  elt_ndx) const

Return the index of the beginning of the range.

Parameters
elt_ndxThe index of this element in its container.

◆ end()

index_type SG::JaggedVecEltBase::end ( ) const

Return the index of the end of the range.

◆ operator==()

bool SG::JaggedVecEltBase::operator== ( const JaggedVecEltBase other) const

Equality test.

Parameters
otherOther element with which to compare.

◆ size()

size_t SG::JaggedVecEltBase::size ( size_t  elt_ndx) const

Return the number of items in this range.

Parameters
elt_ndxThe index of this element in its container.

Friends And Related Function Documentation

◆ Shift

friend struct Shift
friend

Definition at line 119 of file JaggedVecImpl.h.

Member Data Documentation

◆ m_end

index_type SG::JaggedVecEltBase::m_end = 0
private

End index.

Definition at line 122 of file JaggedVecImpl.h.


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