Debian Codegraph @

Source/Reasoner/Answerer/Composition/CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData.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 #ifndef KONCLUDE_REASONER_ANSWERER_COMPOSITION_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTORDATA_CPP
22 #define KONCLUDE_REASONER_ANSWERER_COMPOSITION_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTORDATA_CPP
23
24
25 #include "CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData.h"
26
27 namespace Konclude {
28
29 namespace Reasoner {
30
31 namespace Answerer {
32
33 namespace Composition {
34
35 template<class T>
36 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData(CMemoryAllocationManager* reallocationMemMan) : CMemoryPoolReallocationIncreasingContext(reallocationMemMan, 100, 500000, 2) {
37 mBatchLinker = nullptr;
38 mLastBatchLinker = nullptr;
39 }
40
41
42 template<class T>
43 bool CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::hasMoreBatchLinker() {
44 return mBatchLinker != nullptr;
45 }
46
47
48
49 template<class T>
50 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::mergeBatchLinkers(CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>* vecData) {
51 if (vecData && vecData->mBatchLinker) {
52 vecData->mLastBatchLinker->setNext(mBatchLinker);
53 mBatchLinker = vecData->mBatchLinker;
54 }
55 return this;
56 }
57
58 template<class T>
59 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::addBatchLinker(T* linker) {
60 if (linker) {
61 mBatchLinker = linker->append(mBatchLinker);
62 }
63 if (!mLastBatchLinker && mBatchLinker) {
64 mLastBatchLinker = mBatchLinker->getLastListLink();
65 }
66 return this;
67 }
68
69 template<class T>
70 T* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::takeNextBatchLinker() {
71 T* tmpLinker = mBatchLinker;
72 if (mBatchLinker) {
73 mBatchLinker = mBatchLinker->getNext();
74 if (!mBatchLinker) {
75 mLastBatchLinker = nullptr;
76 }
77 }
78 return tmpLinker;
79 }
80
81 template<class T>
82 T* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::getNextBatchLinker() const {
83 T* tmpLinker = mBatchLinker;
84 return tmpLinker;
85 }
86
87
88 template<class T>
89 T* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>::createBatchLinker() {
90 T* linker = CObjectAllocator<T>::allocateAndConstruct(&mMemMan);
91 return linker;
92 }
93
94
95 }; // end namespace Composition
96
97 }; // end namespace Answerer
98
99 }; // end namespace Reasoner
100
101 }; // end namespace Konclude
102
103 #endif // KONCLUDE_REASONER_ANSWERER_COMPOSITION_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTORDATA_CPP
104