Average Class allows you to calculate average value for given number of samples.
template <typename _Ch, typename _SizeT = unsigned int>
class AverageT
{
public:
AverageT(_SizeT size);
virtual ~AverageT();
AverageT& operator +=(const _Ch& sample);
float value() const;
operator _Ch() const;
};
typedef AverageT<char> AverageChar;
typedef AverageT<unsigned char> AverageUChar;
typedef AverageT<int> AverageInt;
typedef AverageT<unsigned int> AverageChar;
typedef AverageT<float> AverageChar;
See Average Example on how to use this classes in your sketches.