Debian Codegraph @

Source/Reasoner/Kernel/Process/CCriticalSaturationConceptTypeQueues.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 "CCriticalSaturationConceptTypeQueues.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CCriticalSaturationConceptTypeQueues::CCriticalSaturationConceptTypeQueues(CProcessContext* context) : mContext(context) {
34 mQueueVec = nullptr;
35 }
36
37
38 CCriticalSaturationConceptTypeQueues* CCriticalSaturationConceptTypeQueues::initCriticalSaturationConceptQueues(CIndividualSaturationProcessNode* indiNode) {
39 mIndiNode = indiNode;
40 mQueued = false;;
41 CMemoryAllocationManager* memMan = mContext->getUsedMemoryAllocationManager();
42 mQueueVec = CObjectAllocator< CCriticalSaturationConceptQueue* >::allocateAndConstructArray(memMan,mConceptTypeCount);
43 for (cint64 i = 0; i < mConceptTypeCount; ++i) {
44 mQueueVec[i] = nullptr;
45 }
46 return this;
47 }
48
49
50 bool CCriticalSaturationConceptTypeQueues::hasCriticalSaturationConceptsQueued() {
51 for (cint64 i = 0; i < mConceptTypeCount; ++i) {
52 CCriticalSaturationConceptQueue*& queue = mQueueVec[i];
53 if (queue && queue->hasCriticalConceptDescriptorLinker()) {
54 return true;
55 }
56 }
57 return false;
58 }
59
60 CCriticalSaturationConceptQueue* CCriticalSaturationConceptTypeQueues::getCriticalSaturationConceptQueue(CRITICALSATURATIONCONCEPTQUEUETYPE type, bool create) {
61 CCriticalSaturationConceptQueue*& queue = mQueueVec[(cint64)type];
62 if (!queue && create) {
63 CMemoryAllocationManager* memMan = mContext->getUsedMemoryAllocationManager();
64 queue = CObjectAllocator< CCriticalSaturationConceptQueue >::allocateAndConstruct(memMan);
65 queue->initCriticalSaturationConceptQueue(mIndiNode);
66 }
67 return queue;
68 }
69
70
71 bool CCriticalSaturationConceptTypeQueues::isProcessNodeQueued() {
72 return mQueued;
73 }
74
75 CCriticalSaturationConceptTypeQueues* CCriticalSaturationConceptTypeQueues::setProcessNodeQueued(bool queued) {
76 mQueued = queued;
77 return this;
78 }
79
80
81 }; // end namespace Process
82
83 }; // end namespace Kernel
84
85 }; // end namespace Reasoner
86
87 }; // end namespace Konclude