| 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 "CReasonerWorkloadUpdateReader.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Test { |
| 27 |
|
| 28 |
namespace Analyse { |
| 29 |
|
| 30 |
namespace Reader { |
| 31 |
|
| 32 |
CReasonerWorkloadUpdateReader::CReasonerWorkloadUpdateReader(CAnalyseReasonerManager *reasonerManager) { |
| 33 |
reasoner = reasonerManager; |
| 34 |
|
| 35 |
queryProgressDescription = 0; |
| 36 |
queryTotalWorkDescription = 0; |
| 37 |
queryClosedWorkDescription = 0; |
| 38 |
|
| 39 |
if (reasoner) { |
| 40 |
queryProgressDescription = new CAnalyseValueDescription(); |
| 41 |
queryProgressDescription->setValueName(QString("ReasonerManager::QueryProgress")); |
| 42 |
queryProgressDescription->setTemplateValue(new CDoubleAnalyseValue(0.)); |
| 43 |
|
| 44 |
queryTotalWorkDescription = new CAnalyseValueDescription(); |
| 45 |
queryTotalWorkDescription->setValueName(QString("ReasonerManager::QueryTotalWorkCount")); |
| 46 |
queryTotalWorkDescription->setTemplateValue(new CDoubleAnalyseValue(0.)); |
| 47 |
|
| 48 |
queryClosedWorkDescription = new CAnalyseValueDescription(); |
| 49 |
queryClosedWorkDescription->setValueName(QString("ReasonerManager::QueryCalculatedWorkCount")); |
| 50 |
queryClosedWorkDescription->setTemplateValue(new CDoubleAnalyseValue(0.)); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
CReasonerWorkloadUpdateReader::~CReasonerWorkloadUpdateReader() { |
| 55 |
if (queryProgressDescription) { |
| 56 |
delete queryProgressDescription; |
| 57 |
} |
| 58 |
if (queryTotalWorkDescription) { |
| 59 |
delete queryTotalWorkDescription; |
| 60 |
} |
| 61 |
if (queryClosedWorkDescription) { |
| 62 |
delete queryClosedWorkDescription; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
CAnalyseValueDescription *CReasonerWorkloadUpdateReader::getQueryTotalWorkCountValueDescription() { |
| 69 |
return queryTotalWorkDescription; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
CAnalyseValueDescription *CReasonerWorkloadUpdateReader::getQueryCalcedWorkCountValueDescription() { |
| 74 |
return queryClosedWorkDescription; |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
CAnalyseValueDescription *CReasonerWorkloadUpdateReader::getQueryProgressValueDescription() { |
| 79 |
return queryProgressDescription; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
CAnalyseValue *CReasonerWorkloadUpdateReader::getAnalyseValueUpdate(CAnalyseValueDescription *valueDes) { |
| 86 |
CAnalyseValue *val = 0; |
| 87 |
|
| 88 |
if (valueDes == queryProgressDescription && reasoner) { |
| 89 |
val = new CDoubleAnalyseValue(reasoner->getQueryProgress()); |
| 90 |
} else if (valueDes == queryTotalWorkDescription && reasoner) { |
| 91 |
val = new CDoubleAnalyseValue(reasoner->getQueryTotalWorkCount()); |
| 92 |
} else if (valueDes == queryClosedWorkDescription && reasoner) { |
| 93 |
val = new CDoubleAnalyseValue(reasoner->getQueryCalculatedWorkCount()); |
| 94 |
} |
| 95 |
|
| 96 |
return val; |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
}; // end namespace Reader |
| 102 |
|
| 103 |
}; // end namespace Analyse |
| 104 |
|
| 105 |
}; // end namespace Test |
| 106 |
|
| 107 |
}; // end namespace Konclude |