| 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 "CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Cache { |
| 31 |
|
| 32 |
|
| 33 |
CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker(cint64 ontologyDataUpdateId) { |
| 34 |
mOntologyDataUpdateId = ontologyDataUpdateId; |
| 35 |
mMinUsedRecomputationId = CINT64_MAX; |
| 36 |
mMaxUsedRecomputationId = CINT64_MIN; |
| 37 |
setData(this); |
| 38 |
mOntologyDataActive = true; |
| 39 |
mNextOntologyDataAllInactive = false; |
| 40 |
} |
| 41 |
|
| 42 |
CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::updateUsedRecomputationId(cint64 recomputationId) { |
| 43 |
cint64 currentMinRecomputationId = mMinUsedRecomputationId; |
| 44 |
do { |
| 45 |
cint64 newMinRecomputationId = qMin(currentMinRecomputationId, recomputationId); |
| 46 |
mMinUsedRecomputationId.testAndSetOrdered(currentMinRecomputationId, newMinRecomputationId); |
| 47 |
currentMinRecomputationId = mMinUsedRecomputationId; |
| 48 |
} while (currentMinRecomputationId != qMin(currentMinRecomputationId, recomputationId)); |
| 49 |
|
| 50 |
cint64 currentMaxRecomputationId = mMaxUsedRecomputationId; |
| 51 |
do { |
| 52 |
cint64 newMaxRecomputationId = qMax(currentMaxRecomputationId, recomputationId); |
| 53 |
mMaxUsedRecomputationId.testAndSetOrdered(currentMaxRecomputationId, newMaxRecomputationId); |
| 54 |
currentMaxRecomputationId = mMaxUsedRecomputationId; |
| 55 |
} while (currentMaxRecomputationId != qMax(currentMaxRecomputationId, recomputationId)); |
| 56 |
|
| 57 |
return this; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
cint64 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::getMinUsedRecomputationId() { |
| 62 |
return mMinUsedRecomputationId; |
| 63 |
} |
| 64 |
|
| 65 |
cint64 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::getMaxUsedRecomputationId() { |
| 66 |
return mMaxUsedRecomputationId; |
| 67 |
} |
| 68 |
|
| 69 |
cint64 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::getOntologyDataUpdateId() { |
| 70 |
return mOntologyDataUpdateId; |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
bool CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::isOntologyDataActive() { |
| 75 |
return mOntologyDataActive; |
| 76 |
} |
| 77 |
|
| 78 |
CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::setOntologyDataInactive() { |
| 79 |
mOntologyDataActive = false; |
| 80 |
return this; |
| 81 |
} |
| 82 |
|
| 83 |
bool CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::isNextOntologyDataAllInactive() { |
| 84 |
return mNextOntologyDataAllInactive; |
| 85 |
} |
| 86 |
|
| 87 |
CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker::setNextOntologyDataAllInactive() { |
| 88 |
mNextOntologyDataAllInactive = true; |
| 89 |
return this; |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
}; // end namespace Cache |
| 94 |
|
| 95 |
}; // end namespace Kernel |
| 96 |
|
| 97 |
}; // end namespace Reasoner |
| 98 |
|
| 99 |
}; // end namespace Konclude |