Class RingBufferFilter<T>
Uses a queue to Shift: For every enqueued value, dequeue is called until the maxSampleCount is reached.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public class RingBufferFilter<T>
Type Parameters
Name | Description |
---|---|
T | The type of the elements stored in the ring buffer. |
Methods
SampleAll(Action<T, int>)
Applies the filterFunction to every queue sample.
Declaration
public void SampleAll(Action<T, int> filterFunction)
Parameters
Type | Name | Description |
---|---|---|
Action<T, int> | filterFunction | The filter function to apply. |
SampleAllNonAlloc<TOut>(TOut, Func<TOut, T, int, TOut>)
Applies the filterFunction to every queue sample.
Declaration
public TOut SampleAllNonAlloc<TOut>(TOut seed, Func<TOut, T, int, TOut> filterFunction)
Parameters
Type | Name | Description |
---|---|---|
TOut | seed | The seed value for aggregating sample values. |
Func<TOut, T, int, TOut> | filterFunction | The function the filter applies per sample. The first parameter is the accumulator, The second parameter is the current sample. The third parameter the total count of samples. |
Returns
Type | Description |
---|---|
TOut |
Type Parameters
Name | Description |
---|---|
TOut |
Shift(T, int, int)
Enqueues the newValue and dequeues overlapping entries.
Declaration
public void Shift(T newValue, int maxSampleCount = 1, int sampleCountDecreasingStepSize = 1)
Parameters
Type | Name | Description |
---|---|---|
T | newValue | The new value to enqueue. |
int | maxSampleCount | The maximum number of samples to enqueue. |
int | sampleCountDecreasingStepSize | The step size how many samples should be dequeued at a time if maxSampleCount is decreasing. |
ShiftAndSampleAll(T, Action<T, int>, int, int)
Shifts with the newValue and applies the filter.
Declaration
public void ShiftAndSampleAll(T newValue, Action<T, int> filterFunction, int maxSampleCount = 1, int sampleCountDecreasingStepSize = 1)
Parameters
Type | Name | Description |
---|---|---|
T | newValue | The new value to enqueue. |
Action<T, int> | filterFunction | The function the filter applies per sample. The first parameter is the current sample. The second parameter the total count of samples. |
int | maxSampleCount | The maximum number of samples to enqueue. |
int | sampleCountDecreasingStepSize | The step size how many samples should be dequeued at a time if maxSampleCount is decreased. |
ShiftAndSampleAllNonAlloc<TOut>(T, TOut, Func<TOut, T, int, TOut>, int, int)
Shifts with the newValue and applies the filter.
Declaration
public TOut ShiftAndSampleAllNonAlloc<TOut>(T newValue, TOut seed, Func<TOut, T, int, TOut> filterFunction, int maxSampleCount = 1, int sampleCountDecreasingStepSize = 1)
Parameters
Type | Name | Description |
---|---|---|
T | newValue | The new value to enqueue. |
TOut | seed | The seed value for aggregating sample values. |
Func<TOut, T, int, TOut> | filterFunction | The function the filter applies per sample. The first parameter is the accumulator, The second parameter is the current sample. The third parameter the total count of samples. |
int | maxSampleCount | The maximum number of samples to enqueue. |
int | sampleCountDecreasingStepSize | The step size how many samples should be dequeued at a time if maxSampleCount is decreased. |
Returns
Type | Description |
---|---|
TOut |
Type Parameters
Name | Description |
---|---|
TOut |