00001 #ifndef GENERICCONDUCTANCEBASEDSPIKINGSYNAPSE_H_ 00002 #define GENERICCONDUCTANCEBASEDSPIKINGSYNAPSE_H_ 00003 00004 #include <boost/format.hpp> 00005 #include <string> 00006 00007 using std::string; 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 "OUNoiseResponse.h" 00018 #include "GenericStaticSpikingSynapse.h" 00019 #include "GABA_BResponse.h" 00020 #include "GABA_BResponseODE.h" 00021 #include "AlphaInfiniteSpikeResponse.h" 00022 00023 template<class Response> 00024 class GenericConductanceBasedSpikingSynapse : public Response 00025 { 00026 00027 public: 00028 00029 GenericConductanceBasedSpikingSynapse() 00030 { 00031 target = &dummyConductanceBasedSynapseTarget; 00032 }; 00033 00034 virtual ~GenericConductanceBasedSpikingSynapse() 00035 { /* NOOP */ 00036 }; 00037 00038 // Reverseal potential of the synapse 00039 float Erev; 00040 00041 // Update internal variables 00042 //virtual int adjust( double dt ) { return Response::adjust( dt ); }; 00043 00044 // Reset to initial condition. 00045 //virtual int reset( double dt ) { return Response::reset( dt ); }; 00046 00047 virtual int advance(AdvanceInfo const &ai) 00048 { 00049 // the synapse first updates its state, then affects the conductance of the neuron 00050 int retval = Response::advance(ai); 00051 target->conductanceInput( Response::psr, Erev ); 00052 return retval; 00053 }; 00054 00055 virtual void outgoing(SimObject *receiver) 00056 { 00057 ConductanceInputTarget *t = dynamic_cast<ConductanceInputTarget *>(receiver->getInputTarget(0)); 00058 if ( t ) { 00059 target = t; 00060 } else { 00061 throw( 00062 PCSIM::Exception( "GenericConductanceBasedSpikingSynapse::outgoing", boost::str( boost::format("Object must be a ConductanceBasedSynapseTarget; which %1% is not!\n") % typeid(*receiver).name() ) ) 00063 ); 00064 } 00065 } 00066 00068 virtual void outgoing(SimObject *receiver, SimObject::ID const& rec, SimObject::ID const& self, SimNetwork & net ) 00069 { 00070 outgoing(receiver); 00071 } 00072 00073 virtual SimObject * getChainedObject() 00074 { 00075 return dynamic_cast<SimObject *>(target); 00076 } 00077 00078 protected: 00079 00081 ConductanceInputTarget *target; 00082 }; 00083 00084 #endif /*GENERICCONDUCTANCEBASEDSPIKINGSYNAPSE_H_*/