visualstub.cpp

来自「amygdata的神经网络算法源代码」· C++ 代码 · 共 64 行

CPP
64
字号
/***************************************************************************                          visualstub.cpp  -  description                             -------------------    begin                : Thu Feb 5 2004    copyright            : (C) 2004 by Rdiger Koch    email                : rkoch@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 "visualstub.h"#include "logging.h"#include <stdexcept>#include <iostream>#include <ltdl.h>using namespace Amygdala;VisualStub::VisualStub(){}VisualStub::~VisualStub(){}void VisualStub::Init(int & argc, char * argv[]){    const char * error;    if(lt_dlinit()) throw std::runtime_error("Could not initialize libtldl");    visualHandle = lt_dlopen("libvisualamygdala.so");    if (!visualHandle)             throw std::runtime_error(lt_dlerror());    c_InitVisual = (InitVisualFunc)lt_dlsym(visualHandle, "InitVisual");    if (c_InitVisual == NULL && (error = lt_dlerror()) != NULL) throw std::runtime_error(error);    c_RunVisual = (RunVisualFunc) lt_dlsym(visualHandle, "RunVisual");    if (c_RunVisual == NULL && (error = lt_dlerror()) != NULL) throw std::runtime_error(error);    c_RunGA = (RunGAFunc) lt_dlsym(visualHandle, "RunGA");    if (c_RunGA == NULL && (error = lt_dlerror()) != NULL) throw std::runtime_error(error);    if(c_InitVisual(&argc, argv) == NULL) throw std::runtime_error("Could not create Visual Object");}void VisualStub::RunVisual() {    LOGGER(1, "Running the Visualizer NN mode");    c_RunVisual();}void VisualStub::RunGA(GenomeHandler * gh) {    std::cout << "Running the Visualizer in GA mode" << std::endl;    c_RunGA(gh);}

⌨️ 快捷键说明

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