OSFI-C++  3.10.0
OpenSF Integration Library
DynamicArray< T > Class Template Reference

#include <DynamicArray.h>

Public Member Functions

 DynamicArray ()=default
 
 DynamicArray (int rows, int columns)
 
 OSFI_DEPRECATED ("Use operator() instead to access elements like mat(i,j)") const std
 
std::vector< T >::const_reference operator() (int i, int j) const
 
std::vector< T >::reference at (int i, int j)
 
std::vector< T >::const_reference at (int i, int j) const
 
void resize (int rows, int columns)
 
int getRows () const
 
int getColumns () const
 

Friends

bool operator== (const DynamicArray &lhs, const DynamicArray &rhs)
 
bool operator!= (const DynamicArray &lhs, const DynamicArray &rhs)
 

Detailed Description

template<typename T>
class DynamicArray< T >

An implementation of a generic and dynamic bi-dimensional matrix.

Constructor & Destructor Documentation

◆ DynamicArray() [1/2]

template<typename T >
DynamicArray< T >::DynamicArray ( )
default

Class default constructor, creates a 0x0 matrix

◆ DynamicArray() [2/2]

template<typename T >
DynamicArray< T >::DynamicArray ( int  rows,
int  columns 
)
inline

Class "size" constructor. Creates an instance of the class, specifying the number of rows and columns.

Parameters
rowsnumber of rows
columnsnumber of columns

Member Function Documentation

◆ at() [1/2]

template<typename T >
std::vector<T>::reference DynamicArray< T >::at ( int  i,
int  j 
)
inline

Indexing operator (checked).

Parameters
irows
jcolumns
Returns
a reference to the element in row i and column j
Exceptions
std::out_of_rangeIf the row or column are not in range

◆ at() [2/2]

template<typename T >
std::vector<T>::const_reference DynamicArray< T >::at ( int  i,
int  j 
) const
inline

Indexing operator (checked).

Parameters
irows
jcolumns
Returns
a reference to the element in row i and column j
Exceptions
std::out_of_rangeIf the row or column are not in range

◆ getColumns()

template<typename T >
int DynamicArray< T >::getColumns ( ) const
inline
Returns
the number of columns.

◆ getRows()

template<typename T >
int DynamicArray< T >::getRows ( ) const
inline
Returns
the number of rows.

◆ operator()()

template<typename T >
std::vector<T>::const_reference DynamicArray< T >::operator() ( int  i,
int  j 
) const
inline

Indexing operator (unchecked).

Parameters
irows
jcolumns
Returns
a reference to the element in row i and column j

◆ OSFI_DEPRECATED()

template<typename T >
DynamicArray< T >::OSFI_DEPRECATED ( "Use operator() instead to access elements like mat(i,j)"  ) const
inline

Constant indexing operator.

Parameters
ielement number
Returns
element address
Deprecated:
Instead, use operator()() to access elements.

Indexing operator (unchecked).

Parameters
irows
jcolumns
Returns
a reference to the element in row i and column j

◆ resize()

template<typename T >
void DynamicArray< T >::resize ( int  rows,
int  columns 
)
inline

Changes the size of the data. New elements will be default initialized.

Parameters
rowsnew number of rows
columnsnew number of columns

Friends And Related Function Documentation

◆ operator!=

template<typename T >
bool operator!= ( const DynamicArray< T > &  lhs,
const DynamicArray< T > &  rhs 
)
friend

Inequality operator. Two instances compare different if either their sizes or values differ.

◆ operator==

template<typename T >
bool operator== ( const DynamicArray< T > &  lhs,
const DynamicArray< T > &  rhs 
)
friend

Equality comparison operator. Two instances compare equal if their sizes and all their values are the same.

Parameters
lhs,rhsinstances to compare
Returns
true if both arrays are equal, false otherwise

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