UniRec  3.0.0
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
NemeaPlusPlus::UnirecArray< T > Class Template Reference

A wrapper class for a contiguous array of values with the same unirec fieldID. More...

#include <unirecArray.hpp>

Data Structures

class  Iterator
 An iterator for the UnirecArray class. More...
 

Public Member Functions

 UnirecArray (T *dataPointer, size_t size, ur_field_id_t fieldID)
 Constructs a UnirecArray object. More...
 
constexpr size_t size () const noexcept
 Returns the number of elements in the UniRec field array. More...
 
constexpr Iterator begin () const noexcept
 Returns an iterator to the first element of the UniRec field array. More...
 
constexpr Iterator end () const noexcept
 Returns an iterator to the element following the last element of the UniRec field array. More...
 
constexpr T & operator[] (size_t pos)
 Returns a reference to the element at the specified position in the UniRec field array. More...
 
constexpr T & at (size_t pos) const
 Returns a reference to the element at the specified position in the UniRec field array, with bounds checking. More...
 

Private Member Functions

void checkDataType (ur_field_type_t fieldDataType) const
 

Private Attributes

size_t m_size
 
T * m_data
 

Detailed Description

template<typename T>
class NemeaPlusPlus::UnirecArray< T >

A wrapper class for a contiguous array of values with the same unirec fieldID.

The UnirecArray class provides a convenient way to work with a contiguous array of values associated with the same unirec fieldID. It supports iterating over the array and provides methods for element access and bounds checking.

Template Parameters
TThe type of the values in the array.

Definition at line 30 of file unirecArray.hpp.

Constructor & Destructor Documentation

◆ UnirecArray()

template<typename T >
NemeaPlusPlus::UnirecArray< T >::UnirecArray ( T *  dataPointer,
size_t  size,
ur_field_id_t  fieldID 
)
inline

Constructs a UnirecArray object.

Parameters
dataPointerA pointer to the first element of the value array.
sizeThe number of elements in the value array.
fieldIDThe unirec fieldID associated with the array.

Definition at line 79 of file unirecArray.hpp.

Member Function Documentation

◆ at()

template<typename T >
constexpr T& NemeaPlusPlus::UnirecArray< T >::at ( size_t  pos) const
inlineconstexpr

Returns a reference to the element at the specified position in the UniRec field array, with bounds checking.

Template Parameters
posThe position of the element to return.
Exceptions
std::out_of_rangeIf pos is out of range of valid element positions in the UniRec field array.
Returns
A reference to the element at the specified position in the UniRec field array.

Definition at line 118 of file unirecArray.hpp.

◆ begin()

template<typename T >
constexpr Iterator NemeaPlusPlus::UnirecArray< T >::begin ( ) const
inlineconstexprnoexcept

Returns an iterator to the first element of the UniRec field array.

Definition at line 94 of file unirecArray.hpp.

◆ checkDataType()

template<typename T >
void NemeaPlusPlus::UnirecArray< T >::checkDataType ( ur_field_type_t  fieldDataType) const
inlineprivate

Definition at line 129 of file unirecArray.hpp.

◆ end()

template<typename T >
constexpr Iterator NemeaPlusPlus::UnirecArray< T >::end ( ) const
inlineconstexprnoexcept

Returns an iterator to the element following the last element of the UniRec field array.

Definition at line 100 of file unirecArray.hpp.

◆ operator[]()

template<typename T >
constexpr T& NemeaPlusPlus::UnirecArray< T >::operator[] ( size_t  pos)
inlineconstexpr

Returns a reference to the element at the specified position in the UniRec field array.

Parameters
posThe position of the element to return.
Returns
T& The reference to the element at the specified position.

Definition at line 108 of file unirecArray.hpp.

◆ size()

template<typename T >
constexpr size_t NemeaPlusPlus::UnirecArray< T >::size ( ) const
inlineconstexprnoexcept

Returns the number of elements in the UniRec field array.

Definition at line 89 of file unirecArray.hpp.

Field Documentation

◆ m_data

template<typename T >
T* NemeaPlusPlus::UnirecArray< T >::m_data
private

Definition at line 137 of file unirecArray.hpp.

◆ m_size

template<typename T >
size_t NemeaPlusPlus::UnirecArray< T >::m_size
private

Definition at line 136 of file unirecArray.hpp.


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