| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CReasonerEvaluationLoader.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Control { |
| 27 |
|
| 28 |
namespace Loader { |
| 29 |
|
| 30 |
|
| 31 |
CReasonerEvaluationLoader::CReasonerEvaluationLoader() { |
| 32 |
mReasonerCommander = nullptr; |
| 33 |
mDeleteReasonerCommander = nullptr; |
| 34 |
mLoaderConfig = nullptr; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
CReasonerEvaluationLoader::~CReasonerEvaluationLoader() { |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
CLoader *CReasonerEvaluationLoader::init(CLoaderFactory *loaderFactory, CConfiguration *config) { |
| 44 |
|
| 45 |
mLoaderConfig = config; |
| 46 |
|
| 47 |
CConfigurationGroup* group = mLoaderConfig->getConfigurationGroup(); |
| 48 |
|
| 49 |
CConfigData* data = mLoaderConfig->createConfig("Konclude.Execution.CommanderManager"); |
| 50 |
CCommanderManagerConfigType* rCConfig = dynamic_cast<CCommanderManagerConfigType*>(data->getConfigType()); |
| 51 |
if (rCConfig) { |
| 52 |
mReasonerCommander = dynamic_cast<CCommanderManagerThread*>(rCConfig->getCommanderManager()); |
| 53 |
} |
| 54 |
|
| 55 |
if (!mReasonerCommander) { |
| 56 |
mDeleteReasonerCommander = mReasonerCommander = new CCommanderManagerThread(); |
| 57 |
rCConfig->setCommanderManager(mReasonerCommander); |
| 58 |
} |
| 59 |
|
| 60 |
group->setConfigDefaultData(group->getConfigIndex("Konclude.Execution.CommanderManager"),data); |
| 61 |
|
| 62 |
return this; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
CLoader *CReasonerEvaluationLoader::load() { |
| 68 |
if (mDeleteReasonerCommander) { |
| 69 |
mDeleteReasonerCommander->realizeCommand(new CInitializeConfigurationCommand(mLoaderConfig)); |
| 70 |
} |
| 71 |
|
| 72 |
QString globalConfig = CConfigDataReader::readConfigString(mLoaderConfig,"Konclude.Evaluation.ConfigFile"); |
| 73 |
QString reasonerConfig = CConfigDataReader::readConfigString(mLoaderConfig,"Konclude.Evaluation.Reasoner.ConfigFile"); |
| 74 |
|
| 75 |
QString testInputDirectory = CConfigDataReader::readConfigString(mLoaderConfig,"Konclude.Evaluation.InputDirectory"); |
| 76 |
QString testOutputDirectory = CConfigDataReader::readConfigString(mLoaderConfig,"Konclude.Evaluation.OutputDirectory"); |
| 77 |
|
| 78 |
QString plattform = CConfigDataReader::readConfigString(mLoaderConfig,"Konclude.Evaluation.Platform"); |
| 79 |
|
| 80 |
CReasonerEvaluationTestsuite* reasonerEvalTestsuite = new CReasonerEvaluationTestsuite(); |
| 81 |
reasonerEvalTestsuite->initEvaluationTestsuite(globalConfig,reasonerConfig,testInputDirectory,testOutputDirectory,plattform,nullptr); |
| 82 |
|
| 83 |
CBlockingCallbackData blockCallData; |
| 84 |
|
| 85 |
CReasonerEvaluationExecutorThread* reasonerExecutorThread = new CReasonerEvaluationExecutorThread(mLoaderConfig); |
| 86 |
reasonerExecutorThread->executeEvaluation(reasonerEvalTestsuite,&blockCallData); |
| 87 |
blockCallData.waitForCallback(); |
| 88 |
delete reasonerExecutorThread; |
| 89 |
|
| 90 |
return this; |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
CLoader *CReasonerEvaluationLoader::exit() { |
| 97 |
delete mDeleteReasonerCommander; |
| 98 |
return this; |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
}; // end namespace Loader |
| 104 |
|
| 105 |
}; // end namespace Control |
| 106 |
|
| 107 |
}; // end namespace Konclude |