![]() |
00001 #if !defined(AFX_GRAPHDATA_H__035AC771_F046_4ECA_BCDE_E570A1138AE4__INCLUDED_) 00002 #define AFX_GRAPHDATA_H__035AC771_F046_4ECA_BCDE_E570A1138AE4__INCLUDED_ 00003 00004 #include <assert.h> 00005 00006 class GraphData { 00007 public: 00008 GraphData(int bufferSize); 00009 virtual ~GraphData(); 00010 00012 int bufferSize; 00013 00015 int dataSize; 00016 00021 int index; 00022 00023 void push(float value){ 00024 if(dataSize<bufferSize){ 00025 data[dataSize]=value; 00026 dataSize++; 00027 } else { 00028 data[(index+dataSize)%dataSize]=value; 00029 index++; 00030 } 00031 } 00032 00033 float getValue(int i){ 00034 assert(i<dataSize); 00035 return data[(index+i)%dataSize]; 00036 } 00037 00038 private: 00039 float* data; 00040 00041 }; 00042 00043 00044 #endif // !defined(AFX_GRAPHDATA_H__035AC771_F046_4ECA_BCDE_E570A1138AE4__INCLUDED_)
![]() |
Thyrix homepage Users' guide
(C) Arxia 2004-2005