uncrustify libraries/Filter/FilterWithBuffer.h

This commit is contained in:
uncrustify 2012-08-16 23:22:11 -07:00 committed by Pat Hickey
parent dbba304af8
commit c284fb144f
1 changed files with 35 additions and 33 deletions

View File

@ -22,7 +22,7 @@
template <class T, uint8_t FILTER_SIZE> template <class T, uint8_t FILTER_SIZE>
class FilterWithBuffer : public Filter<T> class FilterWithBuffer : public Filter<T>
{ {
public: public:
// constructor // constructor
FilterWithBuffer(); FilterWithBuffer();
@ -33,9 +33,11 @@ class FilterWithBuffer : public Filter<T>
virtual void reset(); virtual void reset();
// get filter size // get filter size
virtual uint8_t get_filter_size() { return FILTER_SIZE; }; virtual uint8_t get_filter_size() {
return FILTER_SIZE;
};
protected: protected:
T samples[FILTER_SIZE]; // buffer of samples T samples[FILTER_SIZE]; // buffer of samples
uint8_t sample_index; // pointer to the next empty slot in the buffer uint8_t sample_index; // pointer to the next empty slot in the buffer
}; };
@ -79,7 +81,7 @@ FilterWithBuffer<T,FILTER_SIZE>::FilterWithBuffer() :
// reset - clear all samples from the buffer // reset - clear all samples from the buffer
template <class T, uint8_t FILTER_SIZE> template <class T, uint8_t FILTER_SIZE>
void FilterWithBuffer<T,FILTER_SIZE>::reset() void FilterWithBuffer<T,FILTER_SIZE>:: reset()
{ {
// call base class reset // call base class reset
Filter<T>::reset(); Filter<T>::reset();
@ -95,7 +97,7 @@ void FilterWithBuffer<T,FILTER_SIZE>::reset()
// apply - take in a new raw sample, and return the filtered results // apply - take in a new raw sample, and return the filtered results
template <class T, uint8_t FILTER_SIZE> template <class T, uint8_t FILTER_SIZE>
T FilterWithBuffer<T,FILTER_SIZE>::apply(T sample) T FilterWithBuffer<T,FILTER_SIZE>:: apply(T sample)
{ {
// add sample to array // add sample to array
samples[sample_index++] = sample; samples[sample_index++] = sample;