1 #ifndef PROPAGATEDSPIKEBUFFER_H_
2 #define PROPAGATEDSPIKEBUFFER_H_
23 typedef int spikegroupid_t ;
26 typedef unsigned short int delay_t;
29 typedef unsigned short int delaystep_t;
32 #define PROPAGATED_SPIKE_BUFFER_CHUNK_SIZE 1024
49 int chunkSize = PROPAGATED_SPIKE_BUFFER_CHUNK_SIZE );
76 StgNode* operator->() {
return node; }
77 spikegroupid_t operator*() {
return node->stg; }
79 bool operator==(
const const_iterator& other) {
return ( this->node == other.node ); }
81 bool operator!=(
const const_iterator& other) {
return ( this->node != other.node ); }
83 inline const_iterator& operator++() { node = node->next;
return *
this; }
99 assert( (currIdx + stepOffset +
length() ) %
length() >= 0 );
117 void reset(
int minDelay,
int maxDelay);
120 inline size_t length() {
return ringBufferFront.size(); };
127 void init(
size_t maxDelaySteps);
130 StgNode *getFreeNode(
void);
136 vector< StgNode* > ringBufferFront;
139 vector< StgNode* > ringBufferBack;
142 vector< StgNode* > chunkBuffer;
145 StgNode *currentFreeChunk;
148 int nextFreeSrgNodeIdx;
151 size_t nextFreeChunkIdx;
154 StgNode* recycledNodes;
void nextTimeStep()
Must be called to tell the buffer that it should move on to the next time step.
void reset(int minDelay, int maxDelay)
Must be called at the begin (reset) of a simulation.
Schedule/Store spikes to be delivered at a later point in the simulation.
Iterator to loop over the scheduled spikes at a certain delay.
Structure which stores the index of the spike target group and a pointer to the next element in vario...
const_iterator beginSpikeTargetGroups(int stepOffset=0)
Returns an iterator to loop over all scheduled spike target groups.
void scheduleSpikeTargetGroup(spikegroupid_t stg, delaystep_t delay)
Schedule a group of spike targets to get a spike at time t + delay.
const_iterator endSpikeTargetGroups()
End iterator corresponding to beginSynapseGroups.
PropagatedSpikeBuffer(int minDelay, int maxDelay, int chunkSize=PROPAGATED_SPIKE_BUFFER_CHUNK_SIZE)
New spike buffer.
size_t length()
Return the actual length of the buffer.
virtual ~PropagatedSpikeBuffer()
Destructor: Deletes all scheduled spikes.