Debian Codegraph @

Source/Reasoner/Kernel/Process/CProcessingStatisticGathering.cpp

raw
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 "CProcessingStatisticGathering.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CProcessingStatisticGathering::CProcessingStatisticGathering() {
34 initProcessingStatisticsGathering(nullptr);
35 }
36
37
38 CProcessingStatisticGathering::~CProcessingStatisticGathering() {
39 }
40
41
42
43 CProcessingStatisticGathering* CProcessingStatisticGathering::initProcessingStatisticsGathering(CProcessingStatisticGathering* refStat) {
44 if (refStat) {
45 for (cint64 inx = 0; inx < CProcessingStatistics::statisticVectorSize; ++inx) {
46 mStatVec[inx] += refStat->mStatVec[inx];
47 }
48 } else {
49 for (cint64 inx = 0; inx < CProcessingStatistics::statisticVectorSize; ++inx) {
50 mStatVec[inx] = 0;
51 }
52 }
53 return this;
54 }
55
56
57 CProcessingStatisticGathering* CProcessingStatisticGathering::addGatheredProcessingStatisticsTo(CProcessingStatisticGathering* stat) {
58 if (stat) {
59 for (cint64 inx = 0; inx < CProcessingStatistics::statisticVectorSize; ++inx) {
60 stat->mStatVec[inx] += mStatVec[inx];
61 }
62 }
63 return this;
64 }
65
66
67 cint64* CProcessingStatisticGathering::getProcessingStatisticsVector() {
68 return mStatVec;
69 }
70
71 cint64 CProcessingStatisticGathering::getGatheredProcessingStatistic(cint64 index) {
72 if (index >= 0 && index < CProcessingStatistics::statisticVectorSize) {
73 return mStatVec[index];
74 }
75 return 0;
76 }
77
78
79 }; // end namespace Process
80
81 }; // end namespace Kernel
82
83 }; // end namespace Reasoner
84
85 }; // end namespace Konclude