uncrustify libraries/Filter/AverageFilter.h

This commit is contained in:
uncrustify 2012-08-16 23:22:11 -07:00 committed by Pat Hickey
parent 6bfccd13f8
commit b743ed39b0

View File

@ -22,9 +22,10 @@
template <class T, class U, uint8_t FILTER_SIZE> template <class T, class U, uint8_t FILTER_SIZE>
class AverageFilter : public FilterWithBuffer<T,FILTER_SIZE> class AverageFilter : public FilterWithBuffer<T,FILTER_SIZE>
{ {
public: public:
// constructor // constructor
AverageFilter() : FilterWithBuffer<T,FILTER_SIZE>(), _num_samples(0) {}; AverageFilter() : FilterWithBuffer<T,FILTER_SIZE>(), _num_samples(0) {
};
// apply - Add a new raw value to the filter, retrieve the filtered result // apply - Add a new raw value to the filter, retrieve the filtered result
virtual T apply(T sample); virtual T apply(T sample);
@ -32,7 +33,7 @@ class AverageFilter : public FilterWithBuffer<T,FILTER_SIZE>
// reset - clear the filter // reset - clear the filter
virtual void reset(); virtual void reset();
private: private:
uint8_t _num_samples; // the number of samples in the filter, maxes out at size of the filter uint8_t _num_samples; // the number of samples in the filter, maxes out at size of the filter
}; };
@ -69,7 +70,7 @@ typedef AverageFilter<float,float,5> AverageFilterFloat_Size5;
// Public Methods ////////////////////////////////////////////////////////////// // Public Methods //////////////////////////////////////////////////////////////
template <class T, class U, uint8_t FILTER_SIZE> template <class T, class U, uint8_t FILTER_SIZE>
T AverageFilter<T,U,FILTER_SIZE>::apply(T sample) T AverageFilter<T,U,FILTER_SIZE>:: apply(T sample)
{ {
U result = 0; U result = 0;
@ -90,7 +91,7 @@ T AverageFilter<T,U,FILTER_SIZE>::apply(T sample)
// reset - clear all samples // reset - clear all samples
template <class T, class U, uint8_t FILTER_SIZE> template <class T, class U, uint8_t FILTER_SIZE>
void AverageFilter<T,U,FILTER_SIZE>::reset() void AverageFilter<T,U,FILTER_SIZE>:: reset()
{ {
// call parent's apply function to get the sample into the array // call parent's apply function to get the sample into the array
FilterWithBuffer<T,FILTER_SIZE>::reset(); FilterWithBuffer<T,FILTER_SIZE>::reset();