| 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_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYLABELCACHEITEM_H |
| 22 |
#define KONCLUDE_REASONER_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYLABELCACHEITEM_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "CacheSettings.h" |
| 29 |
#include "CCacheValue.h" |
| 30 |
#include "CBackendRepresentativeMemoryCacheContext.h" |
| 31 |
#include "CBackendRepresentativeMemoryLabelValueLinker.h" |
| 32 |
#include "CBackendRepresentativeMemoryCachingFlags.h" |
| 33 |
#include "CBackendRepresentativeMemoryLabelCacheItemExtensionData.h" |
| 34 |
|
| 35 |
|
| 36 |
// Other includes |
| 37 |
#include "Utilities/Memory/CObjectParameterizingAllocator.h" |
| 38 |
|
| 39 |
// Logger includes |
| 40 |
#include "Logger/CLogger.h" |
| 41 |
|
| 42 |
|
| 43 |
namespace Konclude { |
| 44 |
|
| 45 |
using namespace Utilities::Memory; |
| 46 |
|
| 47 |
namespace Reasoner { |
| 48 |
|
| 49 |
namespace Kernel { |
| 50 |
|
| 51 |
namespace Cache { |
| 52 |
|
| 53 |
/*! |
| 54 |
* |
| 55 |
* \class CBackendRepresentativeMemoryLabelCacheItem |
| 56 |
* \author Andreas Steigmiller |
| 57 |
* \version 0.1 |
| 58 |
* \brief TODO |
| 59 |
* |
| 60 |
*/ |
| 61 |
class CBackendRepresentativeMemoryLabelCacheItem : public CLinkerBase<cint64,CBackendRepresentativeMemoryLabelCacheItem>, public CBackendRepresentativeMemoryCachingFlags { |
| 62 |
// public methods |
| 63 |
public: |
| 64 |
|
| 65 |
enum LABEL_CACHE_ITEM_TYPE { |
| 66 |
DETERMINISTIC_CONCEPT_SET_LABEL = 0, |
| 67 |
NONDETERMINISTIC_CONCEPT_SET_LABEL = 1, |
| 68 |
|
| 69 |
FULL_CONCEPT_SET_LABEL = 2, |
| 70 |
|
| 71 |
DETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL = 3, |
| 72 |
NONDETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL = 4, |
| 73 |
DETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL = 5, |
| 74 |
NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL = 6, |
| 75 |
|
| 76 |
|
| 77 |
DETERMINISTIC_COMBINED_DATA_INSTANTIATED_ROLE_SET_LABEL = 7, |
| 78 |
NONDETERMINISTIC_COMBINED_DATA_INSTANTIATED_ROLE_SET_LABEL = 8, |
| 79 |
|
| 80 |
|
| 81 |
DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL = 9, |
| 82 |
NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL = 10, |
| 83 |
|
| 84 |
DETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL = 11, |
| 85 |
NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL = 12, |
| 86 |
|
| 87 |
|
| 88 |
INDIRECTLY_CONNECTED_NOMINAL_INDIVIDUAL_SET_LABEL = 13, |
| 89 |
|
| 90 |
|
| 91 |
NEIGHBOUR_INSTANTIATED_ROLE_SET_COMBINATION_LABEL = 14, |
| 92 |
NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL = 15, |
| 93 |
|
| 94 |
}; |
| 95 |
|
| 96 |
static const cint64 LABEL_CACHE_ITEM_ASSOCIATABLE_TYPE_COUNT = 15; |
| 97 |
static const cint64 LABEL_CACHE_ITEM_TYPE_COUNT = 16; |
| 98 |
|
| 99 |
|
| 100 |
//! Constructor |
| 101 |
CBackendRepresentativeMemoryLabelCacheItem(CBackendRepresentativeMemoryCacheContext* context); |
| 102 |
|
| 103 |
|
| 104 |
CBackendRepresentativeMemoryLabelCacheItem* initCacheEntry(cint64 signature, cint64 entryID, LABEL_CACHE_ITEM_TYPE type); |
| 105 |
LABEL_CACHE_ITEM_TYPE getLabelType(); |
| 106 |
|
| 107 |
cint64 getCacheEntryID(); |
| 108 |
CBackendRepresentativeMemoryLabelCacheItem* setCacheEntryID(cint64 entryID); |
| 109 |
|
| 110 |
cint64 getSignature(); |
| 111 |
CBackendRepresentativeMemoryLabelCacheItem* setSignature(cint64 signature); |
| 112 |
|
| 113 |
|
| 114 |
CBackendRepresentativeMemoryLabelCacheItem* addCacheValueLinker(CBackendRepresentativeMemoryLabelValueLinker* linker); |
| 115 |
CBackendRepresentativeMemoryLabelValueLinker* getCacheValueLinker(); |
| 116 |
|
| 117 |
|
| 118 |
CCACHINGHASH<cint64,CBackendRepresentativeMemoryLabelValueLinker*>* getTagCacheValueHash(bool create = false); |
| 119 |
CBackendRepresentativeMemoryLabelCacheItem* setTagCacheValueHash(CCACHINGHASH<cint64,CBackendRepresentativeMemoryLabelValueLinker*>* hash); |
| 120 |
cint64 getCacheValueCount(); |
| 121 |
|
| 122 |
|
| 123 |
bool hasCachedTagValue(cint64 tag); |
| 124 |
|
| 125 |
|
| 126 |
CBackendRepresentativeMemoryLabelCacheItemExtensionData* getExtensionData(cint64 extensionType); |
| 127 |
CBackendRepresentativeMemoryLabelCacheItem* setExtensionData(cint64 extensionType, CBackendRepresentativeMemoryLabelCacheItemExtensionData* extensionData); |
| 128 |
|
| 129 |
CBackendRepresentativeMemoryLabelCacheItem* incIndividualAssociationCount(cint64 count = 1); |
| 130 |
CBackendRepresentativeMemoryLabelCacheItem* decIndividualAssociationCount(cint64 count = 1); |
| 131 |
cint64 getIndividualAssociationCount(); |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
// protected methods |
| 136 |
protected: |
| 137 |
|
| 138 |
// protected variables |
| 139 |
protected: |
| 140 |
CBackendRepresentativeMemoryCacheContext* mContext; |
| 141 |
|
| 142 |
LABEL_CACHE_ITEM_TYPE mCacheItemType; |
| 143 |
|
| 144 |
cint64 mSignature; |
| 145 |
CCACHINGHASH<cint64,CBackendRepresentativeMemoryLabelValueLinker*>* mTagValueHash; |
| 146 |
CBackendRepresentativeMemoryLabelValueLinker* mValueLinker; |
| 147 |
cint64 mValueCount; |
| 148 |
|
| 149 |
cint64 mIndiAssociationCount; |
| 150 |
|
| 151 |
CBackendRepresentativeMemoryLabelCacheItemExtensionData* mExtensionData[CBackendRepresentativeMemoryLabelCacheItemExtensionData::LABEL_CACHE_ITEM_EXTENSION_TYPE_COUNT]; |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
// private methods |
| 156 |
private: |
| 157 |
|
| 158 |
// private variables |
| 159 |
private: |
| 160 |
|
| 161 |
}; |
| 162 |
|
| 163 |
}; // end namespace Cache |
| 164 |
|
| 165 |
}; // end namespace Kernel |
| 166 |
|
| 167 |
}; // end namespace Reasoner |
| 168 |
|
| 169 |
}; // end namespace Konclude |
| 170 |
|
| 171 |
#endif // KONCLUDE_REASONER_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYLABELCACHEITEM_H |