mpspikeinput.cpp

来自「此代码经过大量使用」· C++ 代码 · 共 54 行

CPP
54
字号
/***************************************************************************                          mpspikeinput.cpp  -  description                             -------------------    begin                : Sun Dec 23 2001    copyright            : (C) 2001 by Rudiger Koch    email                : rudiger_koch@yahoo.com ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include "mpspikeinput.h"#include "mpnetwork.h"#include "neuron.h"#include "instance.h"MpSpikeInput::MpSpikeInput(Network *NN) : SpikeInput(NN){    pthread_mutex_init(&spikes_mutex, NULL);    spikes = new vector<Synapse* >;    spikes_rest = new vector<Synapse* >;    NN->SetSpikeInput(this);    NN->StreamingInput(true);}MpSpikeInput::~MpSpikeInput(){}void MpSpikeInput::ReadInputBuffer(){    vector<Synapse* > *tmpSpikes = spikes_rest;    pthread_mutex_lock(&spikes_mutex);    spikes_rest = spikes;    spikes = tmpSpikes;    pthread_mutex_unlock(&spikes_mutex);    net->ScheduleSpikeDelay(*spikes_rest);    spikes_rest->clear();}void MpSpikeInput::queueSpike(Synapse *synapse){    pthread_mutex_lock(&spikes_mutex);    spikes->push_back(synapse);    pthread_mutex_unlock(&spikes_mutex);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?