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