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

📄 factory.cpp

📁 amygdata的神经网络算法源代码
💻 CPP
字号:
/***************************************************************************                          factory.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 "amygdala/factory.h"
#include "amygdala/flatlayer.h"
#include "amygdala/feedforwardlayer.h"
#include "amygdala/lsmtopology.h"
#include "amygdala/fastneuron.h"
#include "amygdala/alphaneuron.h"
#include "amygdala/basicneuron.h"#include "amygdala/inputneuron.h"
#include "amygdala/scheduledspikeinput.h"
#include "amygdala/basicspikeoutput.h"
#include "amygdala/statictrainer.h"
#include "amygdala/pdeltatrainer.h"

using namespace Amygdala;
using namespace std;

FactoryRegistry FactoryBase::registry;

FactoryRegistry::FactoryRegistry()
{
    AddFactory("FlatLayer", new TopologyFactory <FlatLayer> ());
    AddFactory("FeedForwardLayer", new TopologyFactory <FeedForwardLayer> ());
    AddFactory("LSMTopology", new TopologyFactory <LSMTopology> ());
    AddFactory("LSMTopology::Output", new TopologyFactory <LSMTopology::Output> ());
    AddFactory("LSMTopology::Input", new TopologyFactory <LSMTopology::Input> ());
        AddFactory("FastNeuron", new NeuronFactory <FastNeuron, FastNeuronProperties> ());    AddFactory("AlphaNeuron", new NeuronFactory <AlphaNeuron, AlphaNeuronProperties> ());    AddFactory("BasicNeuron", new NeuronFactory <BasicNeuron, BasicNeuronProperties> ());    AddFactory("InputNeuron", new NeuronFactory <InputNeuron, InputNeuronProperties> ());    
    AddFactory("ScheduledSpikeInput", new SpikeInputFactory <ScheduledSpikeInput> ());
    AddFactory("BasicSpikeOutput", new SpikeOutputFactory <BasicSpikeOutput> ());

    AddFactory("StaticHebbianTrainer", new TrainerFactory <StaticHebbianTrainer, StaticHebbianTrainerProperties> ());
    AddFactory("PDeltaTrainer", new TrainerFactory <PDeltaTrainer, PDeltaTrainerProperties> ());
}

FactoryBase* FactoryRegistry::GetFactory(std::string className)
{
	FactoryBase* f = 0;
	f = factories[className];
	if (!f) {
		return 0;
	}	else {		return f;	}
}

void FactoryRegistry::AddFactory(std::string className, FactoryBase* factory)
{
	if (!factories[className]) {
		factories[className] = factory;
	}}

⌨️ 快捷键说明

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