CSIM: spikingneuron.h Source File

spikingneuron.h

Go to the documentation of this file.
00001 
00005 #ifndef _SPIKINGNEURON_H_
00006 #define _SPIKINGNEURON_H_
00007 
00008 #include "neuron.h"
00009 #include "csimlist.h"
00010 #include "spikingsynapse.h"
00011 
00012 
00014 
00022 class SpikingNeuron : public Neuron { 
00023 
00024  public:
00025   
00026   SpikingNeuron(void);
00027 
00029   virtual ~SpikingNeuron();
00030 
00032   virtual void reset(void);
00033 
00034   virtual double nextstate(void) { 
00035     outSpike = hasFired; 
00036     if ( hasFired ) saveSpike();
00037     return hasFired;
00038   };
00039 
00040   virtual void force(double s) {
00041     outSpike = s;
00042   };
00043 
00044   virtual void output(void) { 
00045     if ( outSpike ) propagateSpike(); 
00046   };
00047 
00049   virtual int fired(void) { return hasFired; };
00050 
00052   virtual int isRefractory(void) { return 0; };
00053 
00055   inline int nSpikes(void) { return nEmittedSpikes; };
00056 
00058   inline double spikeTime(int i) { return Spikes[i]; };
00059 
00061   void copySpikes(double *buffer) {
00062     memcpy(buffer,Spikes,sizeof(double)*nEmittedSpikes);
00063   }
00064 
00066   virtual int addIncoming(Advancable *S);
00067 
00069   virtual int addOutgoing(Advancable *S);
00070 
00071  protected:
00073   bool hasFired;
00074 
00075 
00076  private:
00077   // SpikingInputNeuron will be a friend bcs. it will call
00078   // propagateSpike ans saveSpike directly such that it can not be
00079   // forced.
00080   friend class SpikingInputNeuron;
00081 
00083   bool outSpike;
00084 
00086   void propagateSpike(void);
00087 
00089   void saveSpike(void);
00090 
00092   double *Spikes;
00093 
00095   int nEmittedSpikes;
00096 
00098   int nSpikesAlloc;
00099 
00101   struct SpikeDest {
00102     SpikeDest(SpikingSynapse *s, pSpikeHandler h, float *d) {synapse=s; spikeHandler=h; delay=d;}
00103     SpikingSynapse *synapse;
00104     pSpikeHandler  spikeHandler;   // pointer at member function which handles the spike
00105     float *delay;
00106   };
00107 
00108   csimList<SpikeDest,100> SpikeReceiver;
00109 };
00110 
00111 #endif

 
(C) 2003, Thomas Natschläger last modified 07/10/2006