ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
SG::detail::AuxDataSpan< T > Class Template Reference

Auxiliary variable span wrapper. More...

#include <AuxDataSpan.h>

Collaboration diagram for SG::detail::AuxDataSpan< T >:

Public Member Functions

 AuxDataSpan (const AuxDataSpanBase &span)
 Constructor. More...
 
size_t size () const
 Return the size of the span. More...
 
bool empty () const
 Test to see if the span is empty. More...
 
T * data ()
 Return the start of the span. More...
 
const T * data () const
 Return the start of the span (const). More...
 
T & operator[] (size_t index)
 Element access. More...
 
const T & operator[] (size_t index) const
 Element access (const). More...
 
T & at (size_t index)
 Bounds-checked element access. More...
 
const T & at (size_t index) const
 Bounds-checked element access (const). More...
 
T & front ()
 Return the first element in the range. More...
 
const T & front () const
 Return the first element in the range (const). More...
 
T & back ()
 Return the last element in the range. More...
 
const T & back () const
 Return the last element in the range (const). More...
 

Private Attributes

const AuxDataSpanBasem_span
 The wrapped object. More...
 

Detailed Description

template<class T>
class SG::detail::AuxDataSpan< T >

Auxiliary variable span wrapper.

This wraps an AuxDataSpanBase for more user-friendly access. It holds the AuxDataSpanBase by reference, so it will implicity see any changes.

Definition at line 70 of file AuxDataSpan.h.

Constructor & Destructor Documentation

◆ AuxDataSpan()

template<class T >
SG::detail::AuxDataSpan< T >::AuxDataSpan ( const AuxDataSpanBase span)
inline

Constructor.

Parameters
spanThe base object to wrap.

Definition at line 77 of file AuxDataSpan.h.

77 : m_span (span) {}

Member Function Documentation

◆ at() [1/2]

template<class T >
T& SG::detail::AuxDataSpan< T >::at ( size_t  index)
inline

Bounds-checked element access.

index The element index to access.

Definition at line 128 of file AuxDataSpan.h.

129  {
130  if (index >= m_span.size) throw std::out_of_range ("AuxDataSpan");
131  return data()[index];
132  }

◆ at() [2/2]

template<class T >
const T& SG::detail::AuxDataSpan< T >::at ( size_t  index) const
inline

Bounds-checked element access (const).

index The element index to access.

Definition at line 139 of file AuxDataSpan.h.

140  {
141  if (index >= m_span.size) throw std::out_of_range ("AuxDataSpan");
142  return data()[index];
143  }

◆ back() [1/2]

template<class T >
T& SG::detail::AuxDataSpan< T >::back ( )
inline

Return the last element in the range.

Definition at line 161 of file AuxDataSpan.h.

161 { return data()[m_span.size-1]; }

◆ back() [2/2]

template<class T >
const T& SG::detail::AuxDataSpan< T >::back ( ) const
inline

Return the last element in the range (const).

Definition at line 167 of file AuxDataSpan.h.

167 { return data()[m_span.size-1]; }

◆ data() [1/2]

template<class T >
T* SG::detail::AuxDataSpan< T >::data ( )
inline

Return the start of the span.

Definition at line 95 of file AuxDataSpan.h.

95 { return reinterpret_cast<T*> (m_span.beg); }

◆ data() [2/2]

template<class T >
const T* SG::detail::AuxDataSpan< T >::data ( ) const
inline

Return the start of the span (const).

Definition at line 101 of file AuxDataSpan.h.

101 { return reinterpret_cast<T*> (m_span.beg); }

◆ empty()

template<class T >
bool SG::detail::AuxDataSpan< T >::empty ( ) const
inline

Test to see if the span is empty.

Definition at line 89 of file AuxDataSpan.h.

89 { return m_span.size == 0; }

◆ front() [1/2]

template<class T >
T& SG::detail::AuxDataSpan< T >::front ( )
inline

Return the first element in the range.

Definition at line 149 of file AuxDataSpan.h.

149 { return data()[0]; }

◆ front() [2/2]

template<class T >
const T& SG::detail::AuxDataSpan< T >::front ( ) const
inline

Return the first element in the range (const).

Definition at line 155 of file AuxDataSpan.h.

155 { return data()[0]; }

◆ operator[]() [1/2]

template<class T >
T& SG::detail::AuxDataSpan< T >::operator[] ( size_t  index)
inline

Element access.

index The element index to access.

Definition at line 108 of file AuxDataSpan.h.

109  {
110  return data()[index];
111  }

◆ operator[]() [2/2]

template<class T >
const T& SG::detail::AuxDataSpan< T >::operator[] ( size_t  index) const
inline

Element access (const).

index The element index to access.

Definition at line 118 of file AuxDataSpan.h.

119  {
120  return data()[index];
121  }

◆ size()

template<class T >
size_t SG::detail::AuxDataSpan< T >::size ( ) const
inline

Return the size of the span.

Definition at line 83 of file AuxDataSpan.h.

83 { return m_span.size; }

Member Data Documentation

◆ m_span

template<class T >
const AuxDataSpanBase& SG::detail::AuxDataSpan< T >::m_span
private

The wrapped object.

Definition at line 172 of file AuxDataSpan.h.


The documentation for this class was generated from the following file:
CxxUtils::span
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
SG::AuxDataSpanBase::size
size_t size
The length of the variable's vector.
Definition: AuxDataSpan.h:55
index
Definition: index.py:1
SG::detail::AuxDataSpan::m_span
const AuxDataSpanBase & m_span
The wrapped object.
Definition: AuxDataSpan.h:172
SG::AuxDataSpanBase::beg
void * beg
Pointer to the start of the variable's vector.
Definition: AuxDataSpan.h:52
DeMoScan.index
string index
Definition: DeMoScan.py:364
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
SG::detail::AuxDataSpan::data
T * data()
Return the start of the span.
Definition: AuxDataSpan.h:95