Arduino Filters master
Filter library for Arduino
Classes | Typedefs | Functions
Containers

Detailed Description

Containers like Array, BitArray, DoublyLinkedList.

+ Collaboration diagram for Containers:

Classes

class  ArraySlice< T, N, Reverse, Const >
 Class for a view on a slice of an array. More...
 
struct  Array< T, N >
 An array wrapper for easy copying, comparing, and iterating. More...
 
class  BitArray< N >
 A class for arrays of bits. More...
 
class  DoublyLinkedList< Node >
 A class for doubly linked lists. More...
 
class  DoublyLinkable< Node >
 A class that can be inherited from to allow inserting into a DoublyLinkedList. More...
 

Typedefs

template<class T , size_t NumRows, size_t NumCols>
using Array2D = Array< Array< T, NumCols >, NumRows >
 An easy alias for two-dimensional Arrays. More...
 

Functions

template<class T , size_t N, class G >
Array< T, N > generateArray (G generator)
 Generate an array using the given generator. More...
 
template<size_t N, class G >
auto generateArray (G generator) -> Array< decltype(generator()), N >
 Generate an array using the given generator. More...
 
template<class T , size_t N, class U >
Array< T, N > copyAs (const Array< U, N > &src)
 Copy an Array to an Array of a different type. More...
 
template<class F , class U , size_t N>
Array< decltype(F{}(U{})), N > apply (const Array< U, N > &src, F f)
 Apply a function to all elements of the array and return a copy. More...
 
template<class T , size_t N, class... Args>
Array< T, N > fillArray (Args... args)
 Fill the array with the same value for each element. More...
 
template<class T , size_t N, class U , class V = U>
Array< T, N > generateIncrementalArray (U start=0, V increment=V(1))
 Generate an array where the first value is given, and the subsequent values are calculated as the previous value incremented with a given value:
\( x[0] = \mathrm{start} \)
\( x[k+1] = x[k] + \mathrm{increment} \) . More...
 
template<class T , size_t M, size_t N>
Array< T, M+N > cat (const Array< T, M > &a, const Array< T, N > &b)
 Concatenate two arrays. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
Array< decltype(T1() *T2()), N1+N2 - 1 > distribute (const ArraySlice< T1, N1, Reverse1, Const1 > &a, const ArraySlice< T2, N2, Reverse2, Const2 > &b)
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Const1>
Array< decltype(T1() *T2()), N1+N2 - 1 > distribute (const ArraySlice< T1, N1, Reverse1, Const1 > &a, const Array< T2, N2 > &b)
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse2, bool Const2>
Array< decltype(T1() *T2()), N1+N2 - 1 > distribute (const Array< T1, N1 > &a, const ArraySlice< T2, N2, Reverse2, Const2 > &b)
 
template<class T1 , class T2 , size_t N1, size_t N2>
Array< decltype(T1() *T2()), N1+N2 - 1 > distribute (const Array< T1, N1 > &a, const Array< T2, N2 > &b)
 
template<size_t Start = 0, size_t End = N - 1>
ArraySlice< T, abs_diff(Start, End)+1,(End< Start), false > slice ()
 Get a view on a slice of the Array. More...
 
template<size_t Start = 0, size_t End = N - 1>
ArraySlice< T, abs_diff(Start, End)+1,(End< Start), true > slice () const
 Get a read-only view on a slice of the Array. More...
 
template<size_t Start, size_t End>
ArraySlice< T, abs_diff(End, Start)+1, Reverse ^(End< Start), Const > slice () const
 
template<class T , size_t N, bool Reverse, bool Const>
ArraySlice< T, N, Reverse, Const >::Iterator operator+ (typename ArraySlice< T, N, Reverse, Const >::Iterator::difference_type n, typename ArraySlice< T, N, Reverse, Const >::Iterator a)
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
bool operator== (ArraySlice< T1, N1, Reverse1, Const1 > a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Slice == Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse2, bool Const2>
bool operator== (const Array< T1, N1 > &a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Array == Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Const1>
bool operator== (ArraySlice< T1, N1, Reverse1, Const1 > a, const Array< T2, N2 > &b)
 Slice == Array. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
bool operator!= (ArraySlice< T1, N1, Reverse1, Const1 > a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Slice != Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse2, bool Const2>
bool operator!= (const Array< T1, N1 > &a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Array != Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Const1>
bool operator!= (ArraySlice< T1, N1, Reverse1, Const1 > a, const Array< T2, N2 > &b)
 Slice != Array. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
Array< decltype(T1{}+T2{}), N1 > operator+ (ArraySlice< T1, N1, Reverse1, Const1 > a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Slice + Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2>
Array< decltype(T1{}+T2{}), N1 > operator+ (const Array< T1, N1 > &a, const Array< T2, N2 > &b)
 Array + Array. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
const ArraySlice< T1, N1, Reverse1, Const1 > & operator+= (const ArraySlice< T1, N1, Reverse1, Const1 > &a, const ArraySlice< T2, N2, Reverse2, Const2 > &b)
 Slice += Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2>
Array< T1, N1 > & operator+= (Array< T1, N1 > &a, const Array< T2, N2 > &b)
 Array += Array. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
Array< decltype(T1{} - T2{}), N1 > operator- (ArraySlice< T1, N1, Reverse1, Const1 > a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Slice - Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2>
Array< decltype(T1{} - T2{}), N1 > operator- (const Array< T1, N1 > &a, const Array< T2, N2 > &b)
 Array - Array. More...
 
template<class T1 , class T2 , size_t N1, size_t N2, bool Reverse1, bool Reverse2, bool Const1, bool Const2>
const ArraySlice< T1, N1, Reverse1, Const1 > & operator-= (const ArraySlice< T1, N1, Reverse1, Const1 > &a, const ArraySlice< T2, N2, Reverse2, Const2 > &b)
 Slice -= Slice. More...
 
template<class T1 , class T2 , size_t N1, size_t N2>
Array< T1, N1 > & operator-= (Array< T1, N1 > &a, const Array< T2, N2 > &b)
 Array -= Array. More...
 
template<class T1 , class T2 , size_t N1, bool Reverse1, bool Const1>
Array< decltype(T1{} *T2{}), N1 > operator* (ArraySlice< T1, N1, Reverse1, Const1 > a, T2 b)
 Slice * Scalar. More...
 
template<class T1 , class T2 , size_t N1>
Array< decltype(T1{} *T2{}), N1 > operator* (const Array< T1, N1 > &a, T2 b)
 Array * Scalar. More...
 
template<class T1 , class T2 , size_t N2, bool Reverse2, bool Const2>
Array< decltype(T1{} *T2{}), N2 > operator* (T1 a, ArraySlice< T2, N2, Reverse2, Const2 > b)
 Scalar * Slice. More...
 
template<class T1 , class T2 , size_t N2>
Array< decltype(T1{} *T2{}), N2 > operator* (T1 a, const Array< T2, N2 > &b)
 Scalar * Array. More...
 
template<class T1 , class T2 , size_t N1, bool Reverse1, bool Const1>
const ArraySlice< T1, N1, Reverse1, Const1 > & operator*= (const ArraySlice< T1, N1, Reverse1, Const1 > &a, T2 b)
 Slice *= Scalar. More...
 
template<class T1 , class T2 , size_t N1>
Array< T1, N1 > & operator*= (Array< T1, N1 > &a, T2 b)
 Array *= Scalar. More...
 
template<class T1 , class T2 , size_t N1, bool Reverse1, bool Const1>
Array< decltype(T1{}/T2{}), N1 > operator/ (ArraySlice< T1, N1, Reverse1, Const1 > a, T2 b)
 Slice / Scalar. More...
 
template<class T1 , class T2 , size_t N1>
Array< decltype(T1{}/T2{}), N1 > operator/ (const Array< T1, N1 > &a, T2 b)
 Array / Scalar. More...
 
template<class T1 , class T2 , size_t N1, bool Reverse1, bool Const1>
const ArraySlice< T1, N1, Reverse1, Const1 > & operator/= (const ArraySlice< T1, N1, Reverse1, Const1 > &a, T2 b)
 Slice /= Scalar. More...
 
template<class T1 , class T2 , size_t N1>
Array< T1, N1 > & operator/= (Array< T1, N1 > &a, T2 b)
 Array /= Scalar. More...
 
template<class T , size_t N, bool Reverse, bool Const>
Array< decltype(-T{}), N > operator- (ArraySlice< T, N, Reverse, Const > a)
 -Slice More...
 
template<class T , size_t N>
Array< decltype(-T{}), N > operator- (const Array< T, N > &a)
 -Array More...
 

Typedef Documentation

◆ Array2D

using Array2D = Array<Array<T, NumCols>, NumRows>

An easy alias for two-dimensional Arrays.

Definition at line 606 of file Array.hpp.

Function Documentation

◆ generateArray() [1/2]

Array< T, N > generateArray ( generator)

Generate an array using the given generator.

Template Parameters
TThe type of the elements in the array.
NThe number of elements in the array.
GThe generator functor type.
Parameters
generatorA functor that will be called to create each element.
Returns
The generated array.

Definition at line 68 of file ArrayHelpers.hpp.

◆ generateArray() [2/2]

auto generateArray ( generator) -> Array<decltype(generator()), N>

Generate an array using the given generator.

Template Parameters
NThe number of elements in the array.
GThe generator functor type.
Parameters
generatorA functor that will be called to create each element.
Returns
The generated array.

Definition at line 88 of file ArrayHelpers.hpp.

◆ copyAs()

Array< T, N > copyAs ( const Array< U, N > &  src)

Copy an Array to an Array of a different type.

Template Parameters
TThe type of the new array.
NThe number of elements in the arrays.
UThe type of the source array.
Parameters
srcThe source array to be copied.

Definition at line 109 of file ArrayHelpers.hpp.

◆ apply()

Array< decltype(F{}(U{})), N > apply ( const Array< U, N > &  src,
f 
)

Apply a function to all elements of the array and return a copy.

Definition at line 121 of file ArrayHelpers.hpp.

◆ fillArray()

Array< T, N > fillArray ( Args...  args)

Fill the array with the same value for each element.

Definition at line 133 of file ArrayHelpers.hpp.

◆ generateIncrementalArray()

Array< T, N > generateIncrementalArray ( start = 0,
increment = V(1) 
)

Generate an array where the first value is given, and the subsequent values are calculated as the previous value incremented with a given value:
\( x[0] = \mathrm{start} \)
\( x[k+1] = x[k] + \mathrm{increment} \) .

For example:

auto x = generateIncrementalArray<unsigned int, 4>(2, 3);

is equivalent to

Array<unsigned int, 4> x = {2, 5, 8, 11};
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
Template Parameters
TThe type of the elements in the array.
NThe number of elements in the array.
UThe type of the initial value.
VThe type of the value that will be added to each subsequent element.
Parameters
startThe first value in the array.
incrementThe value to add to each subsequent element of the array.
Returns
The generated array.

Definition at line 180 of file ArrayHelpers.hpp.

◆ cat()

Array< T, M+N > cat ( const Array< T, M > &  a,
const Array< T, N > &  b 
)

Concatenate two arrays.

Template Parameters
TThe type of the elements in the array.
MThe number of elements in the first array.
NThe number of elements in the second array.
Parameters
aThe first array.
bThe second array.
Returns
A new array containing the elements of both input arrays (in order).

Definition at line 201 of file ArrayHelpers.hpp.

◆ distribute() [1/4]

Array< decltype(T1() *T2()), N1+N2 - 1 > distribute ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
const ArraySlice< T2, N2, Reverse2, Const2 > &  b 
)

Definition at line 215 of file ArrayHelpers.hpp.

◆ distribute() [2/4]

Array< decltype(T1() *T2()), N1+N2 - 1 > distribute ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
const Array< T2, N2 > &  b 
)

Definition at line 226 of file ArrayHelpers.hpp.

◆ distribute() [3/4]

Array< decltype(T1() *T2()), N1+N2 - 1 > distribute ( const Array< T1, N1 > &  a,
const ArraySlice< T2, N2, Reverse2, Const2 > &  b 
)

Definition at line 233 of file ArrayHelpers.hpp.

◆ distribute() [4/4]

Array< decltype(T1() *T2()), N1+N2 - 1 > distribute ( const Array< T1, N1 > &  a,
const Array< T2, N2 > &  b 
)

Definition at line 240 of file ArrayHelpers.hpp.

◆ slice() [1/3]

ArraySlice< T, abs_diff(Start, End)+1,(End< Start), false > slice
inline

Get a view on a slice of the Array.

Doesn't copy the contents of the array, it's just a reference to the original array.

Template Parameters
StartThe start index of the slice.
EndThe end index of the slice.

Definition at line 309 of file Array.hpp.

◆ slice() [2/3]

ArraySlice< T, abs_diff(Start, End)+1,(End< Start), true > slice
inline

Get a read-only view on a slice of the Array.

Doesn't copy the contents of the array, it's just a reference to the original array.

Template Parameters
StartThe start index of the slice.
EndThe end index of the slice.

Definition at line 318 of file Array.hpp.

◆ slice() [3/3]

ArraySlice< T, abs_diff(End, Start)+1, Reverse ^(End< Start), Const > slice

Definition at line 327 of file Array.hpp.

◆ operator+() [1/3]

ArraySlice< T, N, Reverse, Const >::Iterator operator+ ( typename ArraySlice< T, N, Reverse, Const >::Iterator::difference_type  n,
typename ArraySlice< T, N, Reverse, Const >::Iterator  a 
)
related

Definition at line 335 of file Array.hpp.

◆ operator==() [1/3]

bool operator== ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Slice == Slice.

Definition at line 347 of file Array.hpp.

◆ operator==() [2/3]

bool operator== ( const Array< T1, N1 > &  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Array == Slice.

Definition at line 359 of file Array.hpp.

◆ operator==() [3/3]

bool operator== ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
const Array< T2, N2 > &  b 
)
related

Slice == Array.

Definition at line 367 of file Array.hpp.

◆ operator!=() [1/3]

bool operator!= ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Slice != Slice.

Definition at line 378 of file Array.hpp.

◆ operator!=() [2/3]

bool operator!= ( const Array< T1, N1 > &  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Array != Slice.

Definition at line 386 of file Array.hpp.

◆ operator!=() [3/3]

bool operator!= ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
const Array< T2, N2 > &  b 
)
related

Slice != Array.

Definition at line 394 of file Array.hpp.

◆ operator+() [2/3]

Array< decltype(T1{}+T2{}), N1 > operator+ ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Slice + Slice.

Definition at line 406 of file Array.hpp.

◆ operator+() [3/3]

Array< decltype(T1{}+T2{}), N1 > operator+ ( const Array< T1, N1 > &  a,
const Array< T2, N2 > &  b 
)
related

Array + Array.

Definition at line 418 of file Array.hpp.

◆ operator+=() [1/2]

const ArraySlice< T1, N1, Reverse1, Const1 > & operator+= ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
const ArraySlice< T2, N2, Reverse2, Const2 > &  b 
)
related

Slice += Slice.

Definition at line 428 of file Array.hpp.

◆ operator+=() [2/2]

Array< T1, N1 > & operator+= ( Array< T1, N1 > &  a,
const Array< T2, N2 > &  b 
)
related

Array += Array.

Definition at line 439 of file Array.hpp.

◆ operator-() [1/4]

Array< decltype(T1{} - T2{}), N1 > operator- ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Slice - Slice.

Definition at line 451 of file Array.hpp.

◆ operator-() [2/4]

Array< decltype(T1{} - T2{}), N1 > operator- ( const Array< T1, N1 > &  a,
const Array< T2, N2 > &  b 
)
related

Array - Array.

Definition at line 463 of file Array.hpp.

◆ operator-=() [1/2]

const ArraySlice< T1, N1, Reverse1, Const1 > & operator-= ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
const ArraySlice< T2, N2, Reverse2, Const2 > &  b 
)
related

Slice -= Slice.

Definition at line 473 of file Array.hpp.

◆ operator-=() [2/2]

Array< T1, N1 > & operator-= ( Array< T1, N1 > &  a,
const Array< T2, N2 > &  b 
)
related

Array -= Array.

Definition at line 484 of file Array.hpp.

◆ operator*() [1/4]

Array< decltype(T1{} *T2{}), N1 > operator* ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
T2  b 
)
related

Slice * Scalar.

Definition at line 495 of file Array.hpp.

◆ operator*() [2/4]

Array< decltype(T1{} *T2{}), N1 > operator* ( const Array< T1, N1 > &  a,
T2  b 
)
related

Array * Scalar.

Definition at line 505 of file Array.hpp.

◆ operator*() [3/4]

Array< decltype(T1{} *T2{}), N2 > operator* ( T1  a,
ArraySlice< T2, N2, Reverse2, Const2 >  b 
)
related

Scalar * Slice.

Definition at line 513 of file Array.hpp.

◆ operator*() [4/4]

Array< decltype(T1{} *T2{}), N2 > operator* ( T1  a,
const Array< T2, N2 > &  b 
)
related

Scalar * Array.

Definition at line 523 of file Array.hpp.

◆ operator*=() [1/2]

const ArraySlice< T1, N1, Reverse1, Const1 > & operator*= ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
T2  b 
)
related

Slice *= Scalar.

Definition at line 531 of file Array.hpp.

◆ operator*=() [2/2]

Array< T1, N1 > & operator*= ( Array< T1, N1 > &  a,
T2  b 
)
related

Array *= Scalar.

Definition at line 540 of file Array.hpp.

◆ operator/() [1/2]

Array< decltype(T1{}/T2{}), N1 > operator/ ( ArraySlice< T1, N1, Reverse1, Const1 >  a,
T2  b 
)
related

Slice / Scalar.

Definition at line 551 of file Array.hpp.

◆ operator/() [2/2]

Array< decltype(T1{}/T2{}), N1 > operator/ ( const Array< T1, N1 > &  a,
T2  b 
)
related

Array / Scalar.

Definition at line 561 of file Array.hpp.

◆ operator/=() [1/2]

const ArraySlice< T1, N1, Reverse1, Const1 > & operator/= ( const ArraySlice< T1, N1, Reverse1, Const1 > &  a,
T2  b 
)
related

Slice /= Scalar.

Definition at line 569 of file Array.hpp.

◆ operator/=() [2/2]

Array< T1, N1 > & operator/= ( Array< T1, N1 > &  a,
T2  b 
)
related

Array /= Scalar.

Definition at line 578 of file Array.hpp.

◆ operator-() [3/4]

Array< decltype(-T{}), N > operator- ( ArraySlice< T, N, Reverse, Const >  a)
related

-Slice

Definition at line 588 of file Array.hpp.

◆ operator-() [4/4]

Array< decltype(-T{}), N > operator- ( const Array< T, N > &  a)
related

-Array

Definition at line 598 of file Array.hpp.