Debian Codegraph @

Source/Reasoner/Kernel/Process/CDatatypeDependencyTrackPointCollection.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 "CDatatypeDependencyTrackPointCollection.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CDatatypeDependencyTrackPointCollection::CDatatypeDependencyTrackPointCollection(CProcessContext* processContext) : mDepTrackPointSet(processContext) {
34 mProcessContext = processContext;
35 mClashDepLinker = nullptr;
36 }
37
38
39 CDatatypeDependencyTrackPointCollection* CDatatypeDependencyTrackPointCollection::initDependencyTrackPointCollection(CDatatypeDependencyTrackPointCollection* collection) {
40 if (collection) {
41 mClashDepLinker = collection->mClashDepLinker;
42 mDepTrackPointSet = collection->mDepTrackPointSet;
43 } else {
44 mClashDepLinker = nullptr;
45 mDepTrackPointSet.clear();
46 }
47 return this;
48 }
49
50
51
52 CClashedDependencyDescriptor* CDatatypeDependencyTrackPointCollection::getClashedDependencyDescriptors() {
53 return mClashDepLinker;
54 }
55
56
57 CClashedDependencyDescriptor* CDatatypeDependencyTrackPointCollection::createClashedDependencyDescriptor(CClashedDependencyDescriptor* appendDepDesLinker, CDependencyTrackPoint* depTrackPoint) {
58 if (depTrackPoint) {
59 CClashedDependencyDescriptor* clashDes = CObjectAllocator<CClashedDependencyDescriptor>::allocateAndConstruct(mProcessContext->getUsedMemoryAllocationManager());
60 clashDes->initClashedDependencyDescriptor(depTrackPoint);
61 clashDes->append(appendDepDesLinker);
62 return clashDes;
63 } else {
64 return appendDepDesLinker;
65 }
66 }
67
68
69 bool CDatatypeDependencyTrackPointCollection::addDependency(CDependencyTrackPoint* depTrackPoint) {
70 if (!mDepTrackPointSet.contains(depTrackPoint)) {
71 mDepTrackPointSet.insert(depTrackPoint);
72 mClashDepLinker = createClashedDependencyDescriptor(mClashDepLinker,depTrackPoint);
73 return true;
74 }
75 return false;
76 }
77
78 bool CDatatypeDependencyTrackPointCollection::addCollectionDependencies(CDatatypeValueSpaceDependencyCollector* depCollection) {
79 bool depAdded = false;
80 for (CClashedDependencyDescriptor* clashDesIt = mClashDepLinker; clashDesIt; clashDesIt = clashDesIt->getNext()) {
81 depAdded |= depCollection->addDependency(clashDesIt->getDependencyTrackPoint());
82 }
83 return depAdded;
84 }
85
86
87 }; // end namespace Process
88
89 }; // end namespace Kernel
90
91 }; // end namespace Reasoner
92
93 }; // end namespace Konclude