⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outputmanager.cpp

📁 amygdata的神经网络算法源代码
💻 CPP
字号:
/***************************************************************************                          outputmanager.cpp  -  description                             -------------------    copyright            : (C) 2004 by Matt Grover    email                : mgrover@amygdala.org ***************************************************************************//*************************************************************************** *                                                                         * *   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 "outputmanager.h"#include "spikeoutput.h"#include "neuron.h"#include "logging.h"#include <stdexcept>#define MAX_SPIKEOUT 255using namespace Amygdala;using namespace std;// initialize staticsstd::map< AmGroupInt, vector<Neuron*> > OutputManager::groups;std::map< AmIdInt, SpikeOutput*> OutputManager::spikeOut;OutputManager::OutputManager(){}OutputManager::~OutputManager(){}void OutputManager::Output(Neuron* spikingNeuron){}void OutputManager::SendOutput(Neuron* nrn, AmTimeInt outputTime){    LOGGER(5, "Sending an Outputevent: " << nrn->GetId() << ", Time: " << outputTime);    for (spikeoutput_iterator it = spikeOut.begin(); it != spikeOut.end(); it++){        it->second->OutputEvent(nrn, outputTime);    }}void OutputManager::AddNeuronToGroup(Neuron* nrn, AmGroupInt group){	nrn->AddOutputGroup(group);	groups[group].push_back(nrn);}void OutputManager::EnableOutput(bool enable, unsigned int grp){	Neuron::CaptureOutput(enable, grp);}void OutputManager::EraseSpikeOutput(unsigned short idx){    if(spikeOut.find(idx) != spikeOut.end()){        delete spikeOut[idx];        spikeOut.erase(idx);    } else {        throw runtime_error("Cannot erase SpikeOutput object");    }}unsigned short OutputManager::AddSpikeOutput(SpikeOutput * so){    AmIdInt idx;    for(idx = 1; idx <=MAX_SPIKEOUT; idx++){        if(spikeOut.find(idx) == spikeOut.end()){            spikeOut[idx] = so;            return (unsigned short)idx;        }    }    throw runtime_error("Cannot add SpikeOutput");}

⌨️ 快捷键说明

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