Debian Codegraph @

Source/Reasoner/Triples/CRedlandStoredTriplesIndexingBaseBatchLinkerVector.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_CREDLANDSTOREDTRIPLESINDEXINGBASEBATCHLINKERVECTOR_CPP
22 #define KONCLUDE_REASONER_ANSWERER_CREDLANDSTOREDTRIPLESINDEXINGBASEBATCHLINKERVECTOR_CPP
23
24
25 #include "CRedlandStoredTriplesIndexingBaseBatchLinkerVector.h"
26
27 namespace Konclude {
28
29 namespace Reasoner {
30
31 namespace Triples {
32
33 template<class T>
34 CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::CRedlandStoredTriplesIndexingBaseBatchLinkerVector(cint64 size) : QVector<CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData<T>*>(size), CMemoryPoolNewAllocationIncreasingContext(5000, 500000, 2) {
35 mNextIndex = 0;
36 mSize = size;
37 mIndiCreationLinker = nullptr;
38 }
39
40
41 template<class T>
42 CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::CRedlandStoredTriplesIndexingBaseBatchLinkerVector() {
43 mNextIndex = 0;
44 mSize = 0;
45 }
46
47
48
49
50 template<class T>
51 CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData<T>* CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::getVectorLinkerData(cint64 index, bool createIfNotExists) {
52 CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData<T>*& data = QVector<CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData<T>*>::operator[](index);
53 if (!data && createIfNotExists) {
54 data = CObjectParameterizingAllocator< CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData<T>, CMemoryAllocationManager* >::allocateAndConstructAndParameterize(&mMemMan, &mMemMan);
55 }
56 return data;
57 }
58
59
60 template<class T>
61 T* CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::createBatchLinker() {
62 T* linker = CObjectAllocator<T>::allocateAndConstruct(&mMemMan);
63 return linker;
64 }
65
66
67
68
69
70 template<class T>
71 CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>* CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::addBatchLinker(cint64 index, T* linker) {
72 getVectorLinkerData(index)->addBatchLinker(linker);
73 return this;
74 }
75
76 template<class T>
77 cint64 CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::getNextIndex(bool moveNext) {
78 cint64 nextIndex = mNextIndex;
79 if (moveNext) {
80 ++mNextIndex;
81 if (mNextIndex >= mSize) {
82 mNextIndex = 0;
83 }
84 }
85 return nextIndex;
86 }
87
88
89 template<class T>
90 CXLinker<CIndividual*>* CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::getIndvidualCreationLinker() const {
91 return mIndiCreationLinker;
92 }
93
94 template<class T>
95 CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>* CRedlandStoredTriplesIndexingBaseBatchLinkerVector<T>::addCreationIndvidual(CIndividual* indi) {
96 CXLinker<CIndividual*>* linker = CObjectAllocator< CXLinker<CIndividual*> >::allocateAndConstruct(&mMemMan);
97 linker->initLinker(indi);
98 mIndiCreationLinker = linker->append(mIndiCreationLinker);
99 return this;
100 }
101
102
103
104 }; // end namespace Triples
105
106 }; // end namespace Reasoner
107
108 }; // end namespace Konclude
109
110 #endif // KONCLUDE_REASONER_ANSWERER_CREDLANDSTOREDTRIPLESINDEXINGBASEBATCHLINKERVECTOR_CPP
111