ATLAS Offline Software
Loading...
Searching...
No Matches
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.
size_t size () const
 Return the size of the span.
bool empty () const
 Test to see if the span is empty.
T * data ()
 Return the start of the span.
const T * data () const
 Return the start of the span (const).
T & operator[] (size_t index)
 Element access.
const T & operator[] (size_t index) const
 Element access (const).
T & at (size_t index)
 Bounds-checked element access.
const T & at (size_t index) const
 Bounds-checked element access (const).
T & front ()
 Return the first element in the range.
const T & front () const
 Return the first element in the range (const).
T & back ()
 Return the last element in the range.
const T & back () const
 Return the last element in the range (const).

Private Attributes

const AuxDataSpanBasem_span
 The wrapped object.

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 72 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 79 of file AuxDataSpan.h.

79: m_span (span) {}
Auxiliary variable span wrapper.
Definition AuxDataSpan.h:73
const AuxDataSpanBase & m_span
The wrapped object.

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 130 of file AuxDataSpan.h.

131 {
132 if (index >= m_span.size) {
134 }
135 return data()[index];
136 }
T * data()
Return the start of the span.
Definition AuxDataSpan.h:97
void throw_out_of_range(const std::string &what, size_t index, size_t size, const void *obj)
Throw an out_of_range exception.

◆ 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 143 of file AuxDataSpan.h.

144 {
145 if (index >= m_span.size) {
147 }
148 return data()[index];
149 }

◆ back() [1/2]

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

Return the last element in the range.

Definition at line 167 of file AuxDataSpan.h.

167{ 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 173 of file AuxDataSpan.h.

173{ 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 97 of file AuxDataSpan.h.

97{ 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 103 of file AuxDataSpan.h.

103{ 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 91 of file AuxDataSpan.h.

91{ 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 155 of file AuxDataSpan.h.

155{ 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 161 of file AuxDataSpan.h.

161{ 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 110 of file AuxDataSpan.h.

111 {
112 return data()[index];
113 }

◆ 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 120 of file AuxDataSpan.h.

121 {
122 return data()[index];
123 }

◆ size()

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

Return the size of the span.

Definition at line 85 of file AuxDataSpan.h.

85{ 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 178 of file AuxDataSpan.h.


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