// file: cb.h // // this file defines a circular buffer class // // make sure definitions are only made once // #ifndef __CB #define __CB class Circular_buffer { //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // data information // int idx_d; int size_d; float *buf_d; //--------------------------------------------------------------------------- // // public methods // //--------------------------------------------------------------------------- public: // constructors/destructors // Circular_buffer(); ~Circular_buffer(); // allocation // void allocate_cc(int num_elements); // indexing methods // int add_cc(float new_value); // overloaded operators // float operator() (int index); operator float() {return (float)buf_d[idx_d];} float& operator= (float value) { add_cc(value); return buf_d[idx_d]; } //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: // none }; // // end of include file #endif