SimDriver  0.1
Public Member Functions | Protected Attributes | List of all members
agent_model::Filter Class Reference

A class to implement a mean filter. More...

#include <Filter.h>

Public Member Functions

void init (unsigned int length)
 
double value ()
 
double value (double v)
 

Protected Attributes

unsigned int n
 Number of elements.
 
unsigned int i
 Current element's index (circular buffer)
 
std::vector< double > _elements
 Element container.
 

Detailed Description

A class to implement a mean filter.

Member Function Documentation

◆ init()

void agent_model::Filter::init ( unsigned int  length)
inline

Initializes the filter with its length The length is equal to the number of elements of which the mean value is calculated

Parameters
lengthLength of the filter

◆ value() [1/2]

double agent_model::Filter::value ( )
inline

Returns the filtered mean value of the elements

Returns
Filtered mean value

◆ value() [2/2]

double agent_model::Filter::value ( double  v)
inline

Adds the current value and returns the actual filtered value

Parameters
vValue to be added
Returns
The mean value

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