Back to FabImage Library website
You are here: Start » Function Reference » All Functions » Array Composition » AccumulateArray

AccumulateArray
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Joins arrays appearing in consecutive iterations.
Syntax
void fil::AccumulateArray ( const ftl::Array<T>& inArray, ftl::Optional<int> inMaxSize, bool inReset, ftl::Array<Type>& outArray )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inArray | const Array<T>& | Array to be joined | ||
![]() |
inMaxSize | Optional<int> | 0 - ![]() |
NIL | Maximum number of last elements that are remembered |
![]() |
inReset | bool | False | Reset accumulator state | |
![]() |
outArray | Array<Type>& | Joined array |
Examples
To implement basic example perform following steps:
outArray = [1, 2, 3]
k = 2
outArray = [1, 2, 3, 1, 2, 3]
k = 3
outArray = [1, 2, 3, 1, 2, 3, 1, 2, 3]
It is also possible to set maximum size of outArray. For above described example, when inMaxSize is set to 6, after second iteration new data will be appended to outArray while old data will be erased.
k = 1
outArray = [1, 2, 3]
k = 2
outArray = [1, 2, 3, 1, 2, 3]
k = 3
outArray = 1, 2, 3 [1, 2, 3, 1, 2, 3]
- Using FisFilter_CreateArray create 1x3 dimensional array [1, 2, 3]
- Place AccumulateArray inside the body of Loop (or any Enumerate* filter)
- Connect created vector to inArray input of the filter
- After k loop iterations, the output outArray will look like as follows:
outArray = [1, 2, 3]
k = 2
outArray = [1, 2, 3, 1, 2, 3]
k = 3
outArray = [1, 2, 3, 1, 2, 3, 1, 2, 3]
It is also possible to set maximum size of outArray. For above described example, when inMaxSize is set to 6, after second iteration new data will be appended to outArray while old data will be erased.
k = 1
outArray = [1, 2, 3]
k = 2
outArray = [1, 2, 3, 1, 2, 3]
k = 3
outArray = 1, 2, 3 [1, 2, 3, 1, 2, 3]
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | inMaxSize cannot be negative in AccumulateArray. |
See Also
- Loop – Generates a loop that ends at the first invocation with False on the input.