This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Classes | Functions
Containers

Containers like Array, BitArray and DoublyLinkedList. More...

Collaboration diagram for Containers:

Classes

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...
 

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 T , size_t N, class... Args>
Array< T, N > fillArray (Args... args)
 
template<class T , size_t N, class U , class V = U>
Array< T, N > generateIncrementalArray (U start=0, V increment=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...
 

Detailed Description

Containers like Array, BitArray and DoublyLinkedList.

Function Documentation

◆ generateArray() [1/2]

template<class T , size_t N, class G >
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 65 of file ArrayHelpers.hpp.

◆ generateArray() [2/2]

template<size_t N, class G >
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 85 of file ArrayHelpers.hpp.

◆ copyAs()

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.

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 106 of file ArrayHelpers.hpp.

◆ fillArray()

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

Definition at line 114 of file ArrayHelpers.hpp.

◆ generateIncrementalArray()

template<class T , size_t N, class U , class V = U>
Array<T, N> generateIncrementalArray ( start = 0,
increment = 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};
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.
Examples
Toggle-LEDs.ino.

Definition at line 152 of file ArrayHelpers.hpp.

◆ cat()

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.

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 173 of file ArrayHelpers.hpp.

Array
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:20