CSIM: readout.h Source File

readout.h

Go to the documentation of this file.
00001 
00005 #ifndef _READOUT_H_
00006 #define _READOUT_H_
00007 
00008 #include "advanceable.h"
00009 #include "analogfilter.h"
00010 #include "spikefilter.h"
00011 #include "preprocessor.h"
00012 #include "algorithm.h"
00013 #include <list>
00014 #include <string>
00015 #ifndef _WIN32
00016 #include <pthread.h>
00017 #else
00018  #define pthread_mutex_t int
00019  #define pthread_mutex_init(a,b)
00020  #define pthread_mutex_lock(a)
00021  #define pthread_mutex_unlock(a)
00022  #define pthread_mutex_destroy(a)
00023 #endif
00024 #include "csimclass.h"
00025 #include "modelinput.h"
00026 
00027 #define EPSILON 10e-20
00028 
00029 
00030 
00032 
00039 class Readout : public Advancable, public ModelInput {
00040 
00041   DO_REGISTERING
00042 
00043  public:
00044 
00046   Readout(void);
00047 
00049   ~Readout(void);
00050 
00052   virtual int advance();
00053 
00055   virtual int addIncoming(Advancable *Incoming);
00056 
00058   virtual int addOutgoing(Advancable *a);
00059 
00061   virtual int addInputField(csimClass *O, char *fieldname);
00062 
00064   virtual void reset();
00065 
00068   void setAnalogFilter(AnalogFilter *af);
00069 
00072   void setSpikeFilter(SpikeFilter *sf);
00073 
00078   int appendPreprocessor(Preprocessor *pp);
00079 
00084   int prependPreprocessor(Preprocessor *pp);
00085 
00091   int insertPreprocessor(Preprocessor *pp, int position);
00092 
00095   int getNumberPreprocessors();
00096 
00102   int importPreprocessor(int ind, double *rep, int rep_length);
00103 
00108   double* exportPreprocessor(int ind, int *rep_length);
00109 
00113   string getPreprocessorFormatDescription(int ind);
00114 
00118   int setLearningAlgorithm(Algorithm *learner);
00119 
00124   int importAlgorithm(double *rep, int rep_length);
00125 
00129   double* exportAlgorithm(int *rep_length);
00130 
00133   string getAlgorithmFormatDescription();
00134 
00135 
00139   void setRange(double lower_bound, double upper_bound);
00140 
00141 
00142 
00144   inline uint32 getAnalogFilterID(void)  { if (analogFilter) return analogFilter->getId(); else return 0; }
00145 
00147   inline bool hasAnalogFilter(void) { return (analogFilter != 0); }
00148 
00150   inline uint32 getSpikeFilterID(void) { if (spikeFilter) return spikeFilter->getId(); else return 0; };
00151 
00153   inline bool hasSpikeFilter(void) { return (spikeFilter != 0); }
00154 
00156   inline uint32 getAlgorithmID(void) { if (algorithm) return algorithm->getId(); else return 0; };
00157 
00159   inline bool hasAlgorithm(void) { return (algorithm != 0); }
00160 
00162   void getPreprocessorIDs(uint32 *idx);
00163 
00164 
00166   int enabled;
00167 
00168 
00170   double offset;
00171 
00173   double range;
00174 
00175 
00176   // We must also implement some recorder interface, because we want to use
00177   // not only the psr of neurons as input, but also other fields
00178 
00179 
00180  protected:
00181 
00183   struct RecField {
00185     short      i;
00186 
00188     csimClass *o;
00189 
00191     char *p;
00192 
00194     short type;
00195   };
00196 
00198   int add(RecField *f);
00199 
00200 
00202   int nRecFields;
00203 
00205   int lRecFields;
00206 
00208   RecField **recFields;
00209 
00211   int nAnalogFields;
00213   int lAnalogFields;
00214 
00216   int *analogIndices;
00217 
00219   int nSpikingFields;
00221   int lSpikingFields;
00222 
00224   int *spikingIndices;
00225 
00226 
00227 
00229   SynapseTarget **outgoing;
00230 
00232   int nOutgoing;
00234   int lOutgoing;
00235 
00236 
00237 
00238 
00240   //  double output;
00241 
00243   list<Preprocessor *> pre_processors;
00244 
00246   AnalogFilter *analogFilter;
00247 
00249   SpikeFilter *spikeFilter;
00250 
00252   Algorithm *algorithm;
00253 
00254 
00256   static double* m_response;
00258   static double* m_target;
00259 
00261   static int lReservedMemory;
00262 
00264   static pthread_mutex_t mutex_temp_memory;
00265 
00267   static int nReadouts;
00268 
00269 };
00270 
00271 
00272 #endif

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