CbmRoot
Loading...
Searching...
No Matches
cbm::algo::ca::EnumArray< E, T > Class Template Reference

Class of arrays, which can be accessed by an enum class entry as an index. More...

#include <CaEnumArray.h>

Inheritance diagram for cbm::algo::ca::EnumArray< E, T >:
[legend]
Collaboration diagram for cbm::algo::ca::EnumArray< E, T >:
[legend]

Public Member Functions

T & operator[] (const E &entry)
 Mutable access operator, indexed by enum entry.
 
T & operator[] (U index)
 Mutable access operator, indexed by underlying index type.
 
const T & operator[] (const E &entry) const
 Constant access operator, indexed by enum entry.
 
const T & operator[] (U index) const
 Constant access operator, indexed by underlying index type.
 
 operator Arr & () const
 Convertion operator to the base array class.
 

Private Types

using U = typename std::underlying_type<E>::type
 Underlying type of enumeration.
 
using Arr = std::array<T, static_cast<std::size_t>(E::END)>
 

Private Member Functions

template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 

Friends

class boost::serialization::access
 

Detailed Description

template<class E, class T>
class cbm::algo::ca::EnumArray< E, T >

Class of arrays, which can be accessed by an enum class entry as an index.

Note
The enum-array must contain an entry END, which represents the number of the enumeration entries and is used, as an array size
Template Parameters
EThe enum class type
TType of data in the underlying array
Note
The enum-array must contain an entry kEND, which represents the number of the enumeration entries and is used, as an array size
Template Parameters
EThe enum class type
TType of data in the underlying array

Member Typedef Documentation

◆ Arr

template<class E , class T >
using cbm::algo::ca::EnumArray< E, T >::Arr = std::array<T, static_cast<std::size_t>(E::END)>
private

Definition at line 37 of file CaEnumArray.h.

◆ U

template<class E , class T >
using cbm::algo::ca::EnumArray< E, T >::U = typename std::underlying_type<E>::type
private

Underlying type of enumeration.

Definition at line 36 of file CaEnumArray.h.

Member Function Documentation

◆ operator Arr &()

template<class E , class T >
cbm::algo::ca::EnumArray< E, T >::operator Arr & ( ) const
inline

Convertion operator to the base array class.

Definition at line 60 of file CaEnumArray.h.

◆ operator[]() [1/4]

template<class E , class T >
T & cbm::algo::ca::EnumArray< E, T >::operator[] ( const E & entry)
inline

Mutable access operator, indexed by enum entry.

Definition at line 41 of file CaEnumArray.h.

◆ operator[]() [2/4]

template<class E , class T >
const T & cbm::algo::ca::EnumArray< E, T >::operator[] ( const E & entry) const
inline

Constant access operator, indexed by enum entry.

Definition at line 50 of file CaEnumArray.h.

◆ operator[]() [3/4]

template<class E , class T >
T & cbm::algo::ca::EnumArray< E, T >::operator[] ( U index)
inline

Mutable access operator, indexed by underlying index type.

Definition at line 47 of file CaEnumArray.h.

◆ operator[]() [4/4]

template<class E , class T >
const T & cbm::algo::ca::EnumArray< E, T >::operator[] ( U index) const
inline

Constant access operator, indexed by underlying index type.

Parameters
indexIndex of the element

Definition at line 57 of file CaEnumArray.h.

◆ serialize()

template<class E , class T >
template<typename Archive >
void cbm::algo::ca::EnumArray< E, T >::serialize ( Archive & ar,
const unsigned int  )
inlineprivate

Definition at line 65 of file CaEnumArray.h.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<class E , class T >
friend class boost::serialization::access
friend

Definition at line 63 of file CaEnumArray.h.


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