Debian Codegraph @

Source/Test/CThroughputTestTask.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 "CThroughputTestTask.h"
22
23
24 namespace Konclude {
25
26 namespace Test {
27
28
29
30 CThroughputTestTask::CThroughputTestTask(CMemoryPool* memoryPool) : CTask(memoryPool) {
31 mMaxBranchDepth = 0;
32 mCurBranchDepth = 0;
33 mBranchingFactor = 0;
34 }
35
36
37 CThroughputTestTask::~CThroughputTestTask() {
38 }
39
40
41 cint64 CThroughputTestTask::getBranchingFactor() {
42 return mBranchingFactor;
43 }
44
45 cint64 CThroughputTestTask::getCurrentBranchingDepth() {
46 return mCurBranchDepth;
47 }
48
49 cint64 CThroughputTestTask::getMaximumBranchingDepth() {
50 return mMaxBranchDepth;
51 }
52
53
54
55 CTask* CThroughputTestTask::makeTaskReference(CTask* dependedTask, CTaskHandleContext* handlerContext) {
56 CTask::makeTaskReference(dependedTask,handlerContext);
57 CThroughputTestTask* testDepTask = (CThroughputTestTask*)dependedTask;
58 testDepTask->mMaxBranchDepth = mMaxBranchDepth;
59 testDepTask->mBranchingFactor = mBranchingFactor;
60 testDepTask->mCurBranchDepth = mCurBranchDepth+1;
61 return this;
62 }
63
64 CTask* CThroughputTestTask::initTask(CTask* parentTask, CTaskHandleContext* context) {
65 CTask::initTask(parentTask,context);
66 return this;
67 }
68
69 CTask* CThroughputTestTask::initTestTask(cint64 maxBranchDepth, cint64 branchingFactor) {
70 CTask::initTask(nullptr,nullptr);
71 mBranchingFactor = branchingFactor;
72 mMaxBranchDepth = maxBranchDepth;
73 return this;
74 }
75
76
77 bool CThroughputTestTask::hasReachedMaxBranchingDepth() {
78 return mCurBranchDepth >= mMaxBranchDepth;
79 }
80
81 CTaskResult* CThroughputTestTask::createTaskResult(CTaskHandleContext* handlerContext) {
82 return &mBoolTaskResult;
83 }
84
85 CTaskStatus* CThroughputTestTask::createTaskStatus(CTaskHandleContext* handlerContext) {
86 return &mDefaultTaskResult;
87 }
88
89 }; // end namespace Test
90
91 }; // end namespace Konclude