| 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 "CBackendRepresentativeMemoryCachingFlags.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Cache { |
| 31 |
|
| 32 |
|
| 33 |
CBackendRepresentativeMemoryCachingFlags::CBackendRepresentativeMemoryCachingFlags() { |
| 34 |
mStatusFlags = 0; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::initCachingStatusFlags(cint64 flags) { |
| 39 |
mStatusFlags = flags; |
| 40 |
return this; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
bool CBackendRepresentativeMemoryCachingFlags::isCompletelyHandled() { |
| 45 |
return hasStatusFlags(FLAG_COMPLETELY_HANDLED);; |
| 46 |
} |
| 47 |
|
| 48 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::setCompletelyHandled(bool completelyHandled) { |
| 49 |
if (completelyHandled) { |
| 50 |
addStatusFlags(FLAG_COMPLETELY_HANDLED); |
| 51 |
} else { |
| 52 |
clearStatusFlags(FLAG_COMPLETELY_HANDLED); |
| 53 |
} |
| 54 |
return this; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
bool CBackendRepresentativeMemoryCachingFlags::isCompletelySaturated() { |
| 59 |
return hasStatusFlags(FLAG_COMPLETELY_SATURATED); |
| 60 |
} |
| 61 |
|
| 62 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::setCompletelySaturated(bool completelySaturated) { |
| 63 |
if (completelySaturated) { |
| 64 |
addStatusFlags(FLAG_COMPLETELY_SATURATED); |
| 65 |
} else { |
| 66 |
clearStatusFlags(FLAG_COMPLETELY_SATURATED); |
| 67 |
} |
| 68 |
return this; |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
bool CBackendRepresentativeMemoryCachingFlags::isCompletelyPropagated() { |
| 73 |
return hasStatusFlags(FLAG_COMPLETELY_PROPAGATED); |
| 74 |
} |
| 75 |
|
| 76 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::setCompletelyPropagated(bool completelyPropagated) { |
| 77 |
if (completelyPropagated) { |
| 78 |
addStatusFlags(FLAG_COMPLETELY_PROPAGATED); |
| 79 |
} else { |
| 80 |
clearStatusFlags(FLAG_COMPLETELY_PROPAGATED); |
| 81 |
} |
| 82 |
return this; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
bool CBackendRepresentativeMemoryCachingFlags::hasNondeterministicElements() { |
| 88 |
return hasStatusFlags(FLAG_NONDETERMINISTIC_ELEMENTS); |
| 89 |
} |
| 90 |
|
| 91 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::setNondeterministicElements(bool completelySaturated) { |
| 92 |
if (completelySaturated) { |
| 93 |
addStatusFlags(FLAG_NONDETERMINISTIC_ELEMENTS); |
| 94 |
} else { |
| 95 |
clearStatusFlags(FLAG_NONDETERMINISTIC_ELEMENTS); |
| 96 |
} |
| 97 |
return this; |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
bool CBackendRepresentativeMemoryCachingFlags::hasStatusFlags(cint64 flags) { |
| 103 |
return (mStatusFlags & flags) == flags; |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
bool CBackendRepresentativeMemoryCachingFlags::hasStatusFlagsPartially(cint64 flags) { |
| 108 |
return (mStatusFlags & flags) != 0; |
| 109 |
} |
| 110 |
|
| 111 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::setStatusFlags(cint64 flags) { |
| 112 |
mStatusFlags = flags; |
| 113 |
return this; |
| 114 |
} |
| 115 |
|
| 116 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::addStatusFlags(cint64 flags) { |
| 117 |
mStatusFlags |= flags; |
| 118 |
return this; |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
CBackendRepresentativeMemoryCachingFlags* CBackendRepresentativeMemoryCachingFlags::clearStatusFlags(cint64 flags) { |
| 123 |
mStatusFlags &= ~flags; |
| 124 |
return this; |
| 125 |
} |
| 126 |
|
| 127 |
cint64 CBackendRepresentativeMemoryCachingFlags::getStatusFlags() { |
| 128 |
return mStatusFlags; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
}; // end namespace Cache |
| 136 |
|
| 137 |
}; // end namespace Kernel |
| 138 |
|
| 139 |
}; // end namespace Reasoner |
| 140 |
|
| 141 |
}; // end namespace Konclude |