00001 #ifndef SPIKESENDER_H_ 00002 #define SPIKESENDER_H_ 00003 00004 #include <cstdlib> 00005 00006 #include "pcsim_hash.h" 00007 #include "SpikeOutputPort.h" 00008 00009 class SpikeSender 00010 { 00011 public: 00012 virtual ~SpikeSender() {}; 00013 virtual SpikeOutputPort *getSpikePort(size_t p)=0; 00014 }; 00015 00016 class SingleOutputSpikeSender : public SpikeSender 00017 { 00018 00019 public: 00020 virtual ~SingleOutputSpikeSender() {}; 00021 inline void reset() { out_port.clearSpike(); }; 00022 inline SpikeOutputPort *getSpikePort() { return &out_port; }; 00023 virtual SpikeOutputPort *getSpikePort(size_t p) { if( p==0 ) return &out_port; else return NULL; }; 00024 00025 protected: 00026 SpikeOutputPort out_port; 00027 }; 00028 00029 // 00030 // CLASS NOT TESTED!!!!!!!! 00031 // 00032 class MultipleOutputSpikeSender : public SpikeSender 00033 { 00034 00035 public: 00036 00037 MultipleOutputSpikeSender( void ); 00038 00039 virtual ~MultipleOutputSpikeSender( void ); 00040 00041 virtual SpikeOutputPort *getSpikePort(size_t p); 00042 00043 void defineSpikeOutputPort( size_t p ); 00044 00045 void reset(); 00046 00047 // inline const vector< SpikeOutputPort *>& getSpikePorts() const { return out_port; }; 00048 00049 private: 00050 typedef hash_map< size_t , SpikeOutputPort *, PCSIM::hash<size_t> > out_ports_t; 00051 00052 out_ports_t out_ports; 00053 00054 }; 00055 00056 #endif /*SPIKESENDER_H_*/