AMS Advanced Air Mobility Sensors UG
Loading...
Searching...
No Matches
TLabeledArrayInternal< ArrayElementType, LabelEnum > Class Template Reference

A labeled array class template. MUST NOT be instatiated directly. Use the marco DECLARE_LABELED_ARRAY_TEMPLATE to create labels automatically and declare the corresponding array template. Allows access to elements by labels only. More...

Public Types

using ELabels = LabelEnum
 Label enum type alias.
 

Public Member Functions

 TLabeledArrayInternal ()=default
 Default cnstructor. Does not initialize elements.
 
 TLabeledArrayInternal (const ArrayElementType &element)
 Initialize all the array elements with the given value.
 
template<typename... ArgTypes, typename std::enable_if<(sizeof...(ArgTypes)==skuSize_) &&(skuSize_ > 1U), bool >::type = true>
constexpr TLabeledArrayInternal (const ArgTypes &... elements)
 Initialize from a list. The list length must be the same as the array length. The template will be discarded by means of SFINAE technique if the element count in the list does not match array length, or is equal to 1.
 
ArrayElementType * begin ()
 Get pointer to the first element.
 
const ArrayElementType * begin () const
 Get pointer to the first element.
 
ArrayElementType * end ()
 Get pointer to the element after the last one.
 
const ArrayElementType * end () const
 Get pointer to the element after the last one.
 
ArrayElementType & operator[] (LabelEnum eLabel)
 Get array element by label. Asserts if the label is not in the valid range.
 
const ArrayElementType & operator[] (LabelEnum eLabel) const
 Get array element by label. Asserts if the label is not in the valid range.
 

Static Public Attributes

static constexpr uint32_t skuSize_ { static_cast<uint32_t>(LabelEnum::eCount) }
 Size of the labeled array.
 

Detailed Description

template<typename ArrayElementType, typename LabelEnum>
class TLabeledArrayInternal< ArrayElementType, LabelEnum >

A labeled array class template. MUST NOT be instatiated directly. Use the marco DECLARE_LABELED_ARRAY_TEMPLATE to create labels automatically and declare the corresponding array template. Allows access to elements by labels only.

Template Parameters
ArrayElementTypeArray element type
LabelEnumEnum used to label the array elements

Member Typedef Documentation

◆ ELabels

template<typename ArrayElementType , typename LabelEnum >
using TLabeledArrayInternal< ArrayElementType, LabelEnum >::ELabels = LabelEnum

Label enum type alias.

Constructor & Destructor Documentation

◆ TLabeledArrayInternal() [1/3]

template<typename ArrayElementType , typename LabelEnum >
TLabeledArrayInternal< ArrayElementType, LabelEnum >::TLabeledArrayInternal ( )
default

Default cnstructor. Does not initialize elements.

◆ TLabeledArrayInternal() [2/3]

template<typename ArrayElementType , typename LabelEnum >
TLabeledArrayInternal< ArrayElementType, LabelEnum >::TLabeledArrayInternal ( const ArrayElementType &  element)
inline

Initialize all the array elements with the given value.

Parameters
elementValue

◆ TLabeledArrayInternal() [3/3]

template<typename ArrayElementType , typename LabelEnum >
template<typename... ArgTypes, typename std::enable_if<(sizeof...(ArgTypes)==skuSize_) &&(skuSize_ > 1U), bool >::type = true>
constexpr TLabeledArrayInternal< ArrayElementType, LabelEnum >::TLabeledArrayInternal ( const ArgTypes &...  elements)
inlineconstexpr

Initialize from a list. The list length must be the same as the array length. The template will be discarded by means of SFINAE technique if the element count in the list does not match array length, or is equal to 1.

Member Function Documentation

◆ begin() [1/2]

template<typename ArrayElementType , typename LabelEnum >
ArrayElementType * TLabeledArrayInternal< ArrayElementType, LabelEnum >::begin ( )
inline

Get pointer to the first element.

◆ begin() [2/2]

template<typename ArrayElementType , typename LabelEnum >
const ArrayElementType * TLabeledArrayInternal< ArrayElementType, LabelEnum >::begin ( ) const
inline

Get pointer to the first element.

◆ end() [1/2]

template<typename ArrayElementType , typename LabelEnum >
ArrayElementType * TLabeledArrayInternal< ArrayElementType, LabelEnum >::end ( )
inline

Get pointer to the element after the last one.

◆ end() [2/2]

template<typename ArrayElementType , typename LabelEnum >
const ArrayElementType * TLabeledArrayInternal< ArrayElementType, LabelEnum >::end ( ) const
inline

Get pointer to the element after the last one.

◆ operator[]() [1/2]

template<typename ArrayElementType , typename LabelEnum >
ArrayElementType & TLabeledArrayInternal< ArrayElementType, LabelEnum >::operator[] ( LabelEnum  eLabel)
inline

Get array element by label. Asserts if the label is not in the valid range.

◆ operator[]() [2/2]

template<typename ArrayElementType , typename LabelEnum >
const ArrayElementType & TLabeledArrayInternal< ArrayElementType, LabelEnum >::operator[] ( LabelEnum  eLabel) const
inline

Get array element by label. Asserts if the label is not in the valid range.

Member Data Documentation

◆ skuSize_

template<typename ArrayElementType , typename LabelEnum >
constexpr uint32_t TLabeledArrayInternal< ArrayElementType, LabelEnum >::skuSize_ { static_cast<uint32_t>(LabelEnum::eCount) }
staticconstexpr

Size of the labeled array.


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