Debian Codegraph @

Source/Reasoner/Answerer/Composition/CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector.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_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTOR_CPP
22 #define KONCLUDE_REASONER_ANSWERER_COMPOSITION_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTOR_CPP
23
24
25 #include "CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector.h"
26
27 namespace Konclude {
28
29 namespace Reasoner {
30
31 namespace Answerer {
32
33 namespace Composition {
34
35 template<class T>
36 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector(cint64 size) : QVector<CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>*>(size), CMemoryPoolNewAllocationIncreasingContext(5000, 500000, 2) {
37 mNextIndex = 0;
38 mSize = size;
39 }
40
41
42 template<class T>
43 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector() {
44 mNextIndex = 0;
45 mSize = 0;
46 }
47
48
49
50
51 template<class T>
52 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::getVectorLinkerData(cint64 index, bool createIfNotExists) {
53 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>*& data = QVector<CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>*>::operator[](index);
54 if (!data && createIfNotExists) {
55 data = CObjectParameterizingAllocator< CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVectorData<T>, CMemoryAllocationManager* >::allocateAndConstructAndParameterize(&mMemMan, &mMemMan);
56 }
57 return data;
58 }
59
60
61 template<class T>
62 T* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::createBatchLinker() {
63 T* linker = CObjectAllocator<T>::allocateAndConstruct(&mMemMan);
64 return linker;
65 }
66
67
68
69
70
71 template<class T>
72 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>* CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::addBatchLinker(cint64 index, T* linker) {
73 getVectorLinkerData(index)->addBatchLinker(linker);
74 return this;
75 }
76
77 template<class T>
78 cint64 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::getNextIndex(bool moveNext) {
79 cint64 nextIndex = mNextIndex;
80 if (moveNext) {
81 ++mNextIndex;
82 if (mNextIndex >= mSize) {
83 mNextIndex = 0;
84 }
85 }
86 return nextIndex;
87 }
88
89 template<class T>
90 cint64 CQtConcurrentVariableMappingsCompositionBaseBatchLinkerVector<T>::getIndexSize() {
91 return mSize;
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_CQTCONCURRENTVARIABLEMAPPINGSCOMPOSITIONBASEBATCHLINKERVECTOR_CPP
104