GenericCurrentBasedSpikingSynapse.h

Go to the documentation of this file.
00001 #ifndef GENERICCURRENTBASEDSPIKINGSYNAPSE_H_
00002 #define GENERICCURRENTBASEDSPIKINGSYNAPSE_H_
00003 
00004 #include <string>
00005 using std::string;
00006 
00007 #include <boost/format.hpp>
00008 
00009 #include "SimObject.h"
00010 #include "InputTargetTypes.h"
00011 #include "PCSIMException.h"
00012 #include "SimNetwork.h"
00013 #include "ExponentialDecaySpikeResponse.h"
00014 #include "AlphaFunctionSpikeResponse.h"
00015 #include "DoubleExponentialSpikeResponse.h"
00016 #include "SquarePulseSpikeResponse.h"
00017 #include "GenericStaticSpikingSynapse.h"
00018 #include "AlphaInfiniteSpikeResponse.h"
00019 
00020 template<class Response>
00021 class GenericCurrentBasedSpikingSynapse : public Response
00022 {
00023 
00024 public:
00025     GenericCurrentBasedSpikingSynapse()
00026     { 
00027       target = &        dummyCurrentBasedSynapseTarget;
00028     };
00029 
00030     virtual ~GenericCurrentBasedSpikingSynapse()
00031     { /* NOOP */ };
00032 
00033     // Update internal variables
00034     // virtual int adjust( double dt ) { return Response::adjust( dt ); };
00035 
00036     // Reset to initial condition.
00037     // virtual int reset( double dt ) { return Response::reset( dt ); };
00038 
00039     virtual int advance(AdvanceInfo const &ai)
00040     {
00041         // the synapse first updates its state then injects the psr current into the neuron 
00042         int retval = Response::advance(ai); 
00043         target->currentInput( Response::psr );
00044         return retval;        
00045     };
00046     
00047     virtual void outgoing(SimObject *receiver) {    
00048         CurrentInputTarget *t = dynamic_cast<CurrentInputTarget *>(receiver->getInputTarget(0));
00049         if ( t ) {
00050             target = t;
00051         } else {
00052             throw(
00053                 PCSIM::Exception( "GenericCurrentBasedSpikingSynapse::outgoing", boost::str( boost::format( "Object must be a CurrentBasedSynapseTarget; which %1% is not!\n") % typeid(*receiver).name() )  )
00054             );
00055         } 
00056     }
00057 
00059     virtual void outgoing(SimObject *receiver, SimObject::ID const& rec, SimObject::ID const& self, SimNetwork & net )
00060     {
00061         outgoing(receiver);
00062     }
00063     
00064     virtual SimObject * getChainedObject() {
00065         return dynamic_cast<SimObject *>(target);
00066     }
00067     
00068 
00069 
00070 protected:
00071 
00072     CurrentInputTarget *target;
00073 
00074 };
00075 
00076 
00077 #endif /*GENERICCURRENTBASEDSPIKINGSYNAPSE_H_*/

Generated on Wed Jul 9 16:34:39 2008 for PCSIM by  doxygen 1.5.5