00001 // SpikeGraph.h: interface for the SpikeGraph class. 00002 // 00004 00005 #if !defined(AFX_SPIKEGRAPH_H__BB61CB4C_B0D5_4444_BFA1_4088183CC669__INCLUDED_) 00006 #define AFX_SPIKEGRAPH_H__BB61CB4C_B0D5_4444_BFA1_4088183CC669__INCLUDED_ 00007 00008 #include "assert.h" 00009 #include <wx/dc.h> 00010 00012 class SpikeGraph { 00013 public: 00014 SpikeGraph(int nNeurons, int bufferSize); 00015 virtual ~SpikeGraph(); 00016 00018 int bufferSize; 00019 00021 int dataSize; 00022 00023 int nNeurons; 00024 00029 int index; 00030 00031 void push(int neuron, bool value){ 00032 assert(neuron<nNeurons); 00033 if(dataSize<bufferSize){ 00034 data[neuron][dataSize]=value; 00035 } else { 00036 data[neuron][(index+dataSize)%dataSize]=value; 00037 } 00038 } 00039 00040 void advanceTime(){ 00041 if(dataSize<bufferSize){ 00042 dataSize++; 00043 } else { 00044 index++; 00045 } 00046 } 00047 00048 bool getValue(int neuron, int i){ 00049 assert(i<dataSize); 00050 assert(neuron<nNeurons); 00051 return data[neuron][(index+i)%dataSize]; 00052 } 00053 00054 void draw(wxDC* outdc, int x, int y, int h=1); 00055 00056 private: 00057 bool** data; 00058 00059 00060 }; 00061 00062 #endif // !defined(AFX_SPIKEGRAPH_H__BB61CB4C_B0D5_4444_BFA1_4088183CC669__INCLUDED_)
Thyrix homepage Users' guide
(C) Arxia 2004-2005