IDS peak ICV v1.1.0
Loading...
Searching...
No Matches
Array2D< Type, rows, columns > Class Template Reference

#include <peak_icv/types/peak_icv_array_2d.hpp>

Inheritance diagram for Array2D< Type, rows, columns >:

Public Member Functions

constexpr Array2D ()
 Default constructor that initializes the array with default values.
 
constexpr Array2D (const Type(&initList)[rows][columns])
 Constructor that initializes the array with a given 2D initializer list.
 
constexpr Array2D (std::array< Type, rows *columns > data)
 Constructor that initializes the array with a given 1D data array.
 
constexpr const Type * GetData () const
 Returns a pointer to the underlying data of the array.
 
constexpr Type & At (std::size_t row, std::size_t col)
 Accesses the element at the specified row and column.
 
constexpr const Type & At (std::size_t row, std::size_t col) const
 Accesses the element at the specified row and column (const version).
 
constexpr std::size_t GetNumberOfRows () const
 Gets the number of rows in the array.
 
constexpr std::size_t GetNumberOfColumns () const
 Gets the number of columns in the array.
 
auto begin ()
 Returns an iterator to the beginning of the array.
 
auto cbegin () const
 Returns a const iterator to the beginning of the array.
 
auto end ()
 Returns an iterator to the end of the array.
 
auto cend () const
 Returns a const iterator to the end of the array.
 

Detailed Description

template<typename Type, std::size_t rows, std::size_t columns>
class peak::icv::Array2D< Type, rows, columns >

A class template for a two-dimensional array.

This class allows for the storage and manipulation of a 2D array of a specified type, number of rows, and columns.

Template Parameters
TypeThe type of the elements stored in the array.
rowsThe number of rows in the array.
columnsThe number of columns in the array.
Since
ids_peak_icv 1.0

Definition at line 36 of file peak_icv_array_2d.hpp.

Constructor & Destructor Documentation

◆ Array2D() [1/3]

template<typename Type , std::size_t rows, std::size_t columns>
Array2D ( )
inlineconstexpr

Default constructor that initializes the array with default values.

Since
ids_peak_icv 1.0

Definition at line 44 of file peak_icv_array_2d.hpp.

◆ Array2D() [2/3]

template<typename Type , std::size_t rows, std::size_t columns>
Array2D ( const Type(&) initList[rows][columns])
inlineconstexpr

Constructor that initializes the array with a given 2D initializer list.

Parameters
initListA 2D array to initialize the Array2D object.
Since
ids_peak_icv 1.0

Definition at line 55 of file peak_icv_array_2d.hpp.

◆ Array2D() [3/3]

template<typename Type , std::size_t rows, std::size_t columns>
Array2D ( std::array< Type, rows *columns > data)
inlineexplicitconstexpr

Constructor that initializes the array with a given 1D data array.

Parameters
dataA 1D array to initialize the Array2D object.
Since
ids_peak_icv 1.0

Definition at line 73 of file peak_icv_array_2d.hpp.

Member Function Documentation

◆ At() [1/2]

template<typename Type , std::size_t rows, std::size_t columns>
Type & At ( std::size_t row,
std::size_t col )
inlineconstexpr

Accesses the element at the specified row and column.

This method throws an exception if the indices are out of range.

Parameters
rowThe row index of the element to access.
colThe column index of the element to access.
Returns
A reference to the element at the specified indices.
Exceptions
OutOfRangeExceptionIf the row or column index is out of range.
Since
ids_peak_icv 1.0

Definition at line 103 of file peak_icv_array_2d.hpp.

◆ At() [2/2]

template<typename Type , std::size_t rows, std::size_t columns>
const Type & At ( std::size_t row,
std::size_t col ) const
inlineconstexpr

Accesses the element at the specified row and column (const version).

This method throws an exception if the indices are out of range.

Parameters
rowThe row index of the element to access.
colThe column index of the element to access.
Returns
A const reference to the element at the specified indices.
Exceptions
OutOfRangeExceptionIf the row or column index is out of range.
Since
ids_peak_icv 1.0

Definition at line 126 of file peak_icv_array_2d.hpp.

◆ begin()

template<typename Type , std::size_t rows, std::size_t columns>
auto begin ( )

Returns an iterator to the beginning of the array.

Returns
An iterator pointing to the first element of the array.
Since
ids_peak_icv 1.0

Definition at line 212 of file peak_icv_array_2d.hpp.

◆ cbegin()

template<typename T , std::size_t rows, std::size_t columns>
auto cbegin ( ) const

Returns a const iterator to the beginning of the array.

Returns
An iterator pointing to the first element of the array.

Definition at line 218 of file peak_icv_array_2d.hpp.

◆ cend()

template<typename T , std::size_t rows, std::size_t columns>
auto cend ( ) const

Returns a const iterator to the end of the array.

Returns
An iterator pointing to one past the last element of the array.

Definition at line 230 of file peak_icv_array_2d.hpp.

◆ end()

template<typename Type , std::size_t rows, std::size_t columns>
auto end ( )

Returns an iterator to the end of the array.

Returns
An iterator pointing to one past the last element of the array.
Since
ids_peak_icv 1.0

Definition at line 224 of file peak_icv_array_2d.hpp.

◆ GetData()

template<typename Type , std::size_t rows, std::size_t columns>
const Type * GetData ( ) const
inlineconstexpr

Returns a pointer to the underlying data of the array.

Returns
A pointer to the array data.
Since
ids_peak_icv 1.0

Definition at line 84 of file peak_icv_array_2d.hpp.

◆ GetNumberOfColumns()

template<typename Type , std::size_t rows, std::size_t columns>
std::size_t GetNumberOfColumns ( ) const
inlineconstexpr

Gets the number of columns in the array.

Returns
The number of columns in the array.
Since
ids_peak_icv 1.0

Definition at line 154 of file peak_icv_array_2d.hpp.

◆ GetNumberOfRows()

template<typename Type , std::size_t rows, std::size_t columns>
std::size_t GetNumberOfRows ( ) const
inlineconstexpr

Gets the number of rows in the array.

Returns
The number of rows in the array.
Since
ids_peak_icv 1.0

Definition at line 142 of file peak_icv_array_2d.hpp.