00001 #ifndef SINGLETHREADSPIKESCHEDULER_H_
00002 #define SINGLETHREADSPIKESCHEDULER_H_
00003
00004 #include "SpikeScheduler.h"
00005 #include "PropagatedSpikeBuffer.h"
00006 #include "LocalDelayMap.h"
00007 #include "SpikeTargetGroupPool.h"
00008 #include "SimParameter.h"
00009
00011 class SingleThreadSpikeScheduler : public SpikeScheduler
00012 {
00013 public:
00014
00015 SingleThreadSpikeScheduler(LocalDelayMap &dm, SpikeTargetGroupPool &srg, PropagatedSpikeBuffer &sb, SimParameter &sp):
00016 simParam(sp), delayMap(dm), tgtGrpPool(srg), spikeBuffer(sb)
00017 { };
00018
00019 SingleThreadSpikeScheduler(const SingleThreadSpikeScheduler& src):
00020 simParam(src.simParam), delayMap(src.delayMap),
00021 tgtGrpPool(src.tgtGrpPool), spikeBuffer(src.spikeBuffer)
00022 { };
00023
00024 SingleThreadSpikeScheduler& operator=(const SingleThreadSpikeScheduler& src)
00025 {
00026 this->simParam = src.simParam;
00027 this->delayMap = src.delayMap;
00028 this->tgtGrpPool = src.tgtGrpPool;
00029 this->spikeBuffer = src.spikeBuffer;
00030 return *this;
00031 }
00032
00033 virtual ~SingleThreadSpikeScheduler() {};
00034
00035 virtual void scheduleSpike(local_objectid_t senderid, float offsetFraction, engineid_t engine = 0);
00036
00037 virtual void deliverSpikes(SpikeReceiverList &listActiveSynapses, engineid_t engine, double simTime, int stepOffset = 0);
00038
00039 virtual void reset()
00040 {
00041 spikeBuffer.reset( simParam.minDelay.in_steps(simParam.dt), simParam.maxDelay.in_steps(simParam.dt) );
00042 }
00043
00044 virtual void advance(engineid_t engine = 0)
00045 {
00046 spikeBuffer.nextTimeStep();
00047 }
00048
00049 virtual void nextCycle()
00050 {}
00051
00052 protected :
00053 SimParameter &simParam;
00054 LocalDelayMap &delayMap;
00055 SpikeTargetGroupPool &tgtGrpPool;
00056 PropagatedSpikeBuffer &spikeBuffer;
00057
00058 };
00059
00060 #endif