00001 #ifndef ResetRectSpikeResponse_H_
00002 #define ResetRectSpikeResponse_H_
00003
00004 #include "EvSimObject.h"
00005 #include "DirectEventSender.h"
00006 #include "SpikeResponse.h"
00007 #include "EvSimObjectTypeUtils.h"
00008
00009
00010 class ResetRectSpikeResponse : public SpikeResponse, public DirectEventSender {
00011
00012 EV_SIM_OBJECT( ResetRectSpikeResponse )
00013
00014 public:
00015 ResetRectSpikeResponse(float tau = 10e-3) {
00016 this->tau = tau;
00017 }
00018
00019 virtual ~ResetRectSpikeResponse() {};
00020
00021 float tau;
00022
00023 virtual void eventHit(SimContext & sim_info, Time time, port_id_t port);
00024
00025 virtual void updateState(SimContext &sim_info, Time time, update_id_t upd_id) {};
00026
00027 virtual unsigned numInputPorts() const
00028 {
00029 return 2;
00030 };
00031
00032 virtual unsigned numOutputPorts() const
00033 {
00034 return 1;
00035 };
00036
00037
00038 virtual PortType getInputPortType(port_id_t p) const
00039 {
00040 if (p < 2)
00041 return eventPortDirect;
00042 return portUndefined;
00043 };
00044
00045 virtual PortType getOutputPortType(port_id_t p) const
00046 {
00047 if (p == 0)
00048 return eventPortDirect;
00049 return portUndefined;
00050 };
00051
00052 virtual void reset(SimContext &sim_ctxt)
00053 {
00054 r = r_old = 0;
00055 spk_counter = 0;
00056 };
00057
00058 virtual void postAddedInNetwork(EvSimNetwork &net, EvSimObject::ID self) {
00059 net.connect(self, 0, self, 1);
00060 };
00061
00062 protected:
00063 unsigned spk_counter;
00064 };
00065
00066
00067 #endif