00001 #ifndef CONDUCTANCEBASEDANALOGSYNAPSE_H_ 00002 #define CONDUCTANCEBASEDANALOGSYNAPSE_H_ 00003 00004 #include <string> 00005 #include <boost/format.hpp> 00006 00007 #include "AnalogSynapse.h" 00008 #include "InputTargetTypes.h" 00009 #include "PCSIMException.h" 00010 00011 using std::string; 00012 00013 class ConductanceBasedAnalogSynapse : public AnalogSynapse 00014 { 00015 00016 public: 00017 00018 ConductanceBasedAnalogSynapse() 00019 { 00020 target = &dummyConductanceBasedSynapseTarget; 00021 }; 00022 00023 virtual ~ConductanceBasedAnalogSynapse() 00024 { /* NOOP */ }; 00025 00026 // Reverseal potential of the synapse 00027 float Erev; 00028 00029 virtual int advance(AdvanceInfo const &) 00030 { 00031 target->conductanceInput( psr, Erev ); 00032 psr = 0; 00033 return 0; 00034 }; 00035 00037 virtual void outgoing(SimObject *receiver) 00038 { 00039 ConductanceInputTarget *t = dynamic_cast<ConductanceInputTarget *>(receiver->getInputTarget(0)); 00040 if ( t ) { 00041 target = t; 00042 } else { 00043 throw( 00044 PCSIM::Exception( "ConductanceBasedAnalogSynapse::outgoing", boost::str( boost::format("Object must be a ConductanceBasedSynapseTarget; which %1% is not!\n") % typeid(*receiver).name() ) ) 00045 ); 00046 } 00047 } 00048 00049 protected: 00051 ConductanceInputTarget *target; 00052 00053 }; 00054 00055 #endif /* CONDUCTANCEBASEDANALOGSYNAPSE_H_ */