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