Debian Codegraph @

Source/Reasoner/Kernel/Cache/COccurrenceUnsatisfiableCacheReader.h

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_KERNEL_CACHE_COCCURRENCEUNSATISFIABLECACHEREADER_H
22 #define KONCLUDE_REASONER_KERNEL_CACHE_COCCURRENCEUNSATISFIABLECACHEREADER_H
23
24 // Libraries includes
25 #include <QListIterator>
26 #include <QVectorIterator>
27 #include <QAtomicPointer>
28
29 // Namespace includes
30 #include "CacheSettings.h"
31 #include "CCacheValue.h"
32 #include "COccurrenceUnsatisfiableCache.h"
33 #include "COccurrenceUnsatisfiableCacheEntry.h"
34 #include "COccurrenceUnsatisfiableCacheUpdateSlotItem.h"
35 #include "CIncrementalUnsatisfiableCacheReader.h"
36
37
38 // Other includes
39 #include "Utilities/CMemoryManager.hpp"
40 #include "Utilities/CDynamicExpandingMemoryManager.hpp"
41 #include "Utilities/CDblLinker.hpp"
42
43 #include "Utilities/Container/CLinker.h"
44
45 // Logger includes
46 #include "Logger/CLogger.h"
47
48
49 namespace Konclude {
50
51 using namespace Utilities;
52 using namespace Utilities::Container;
53
54 namespace Reasoner {
55
56 namespace Kernel {
57
58 namespace Cache {
59
60 /*!
61 *
62 * \class COccurrenceUnsatisfiableCacheReader
63 * \author Andreas Steigmiller
64 * \version 0.1
65 * \brief TODO
66 *
67 */
68 class COccurrenceUnsatisfiableCacheReader : public CIncrementalUnsatisfiableCacheReader {
69 // public methods
70 public:
71 //! Constructor
72 COccurrenceUnsatisfiableCacheReader(COccurrenceUnsatisfiableCache *unsatisfiableCache);
73
74 //! Destructor
75 virtual ~COccurrenceUnsatisfiableCacheReader();
76
77 virtual bool isUnsatisfiable(QVector<CCacheValue> &itemVec, qint64 count);
78 virtual CDblLinker<COccurrenceUnsatisfiableCacheEntry *> *incrementalUnsatisfiableTest(CCacheValue *cacheValue, CDblLinker<COccurrenceUnsatisfiableCacheEntry *> *cacheEntries, bool *unsatisfiable = 0, bool *continueTesting = 0);
79
80 virtual QList<CCacheValue> getUnsatisfiableItems(QVector<CCacheValue> &itemVec, qint64 count);
81 virtual bool incrementUnsatisfiableTest(CCacheValue *cacheValue, bool *continueTestingUseful = 0);
82 virtual void incrementUnsatisfiableTestReset();
83
84 virtual bool isUnsatisfiable(QVector<CCacheValue> &itemVec, qint64 count, QList<CCacheValue> *unsatisfiableItemList);
85
86 virtual COccurrenceUnsatisfiableCacheUpdateSlotItem *changeUpdateSlot(COccurrenceUnsatisfiableCacheUpdateSlotItem *nextUpdateSlot);
87
88 virtual QList<CCacheValue> getLastTestedUnsatisfiableItems();
89
90
91 CXLinker<CCacheValue*>* getUnsatisfiableItems(CXLinker<CCacheValue*>* cacheValueTestLinker, CMemoryAllocationManager* memMan);
92 cint64 getCurrentCachingTag();
93
94
95 // protected methods
96 protected:
97
98
99 // private methods
100 private:
101 bool moveToNextSlot();
102
103 // private variables
104 private:
105 COccurrenceUnsatisfiableCache *cache;
106 COccurrenceUnsatisfiableCacheUpdateSlotItem *cacheSlotItem;
107 QAtomicPointer<COccurrenceUnsatisfiableCacheUpdateSlotItem> mNextCacheSlotItemPointer;
108
109 CDynamicExpandingMemoryManager<CDblLinker<COccurrenceUnsatisfiableCacheEntry *> > memManCacheEntryList;
110
111 CDblLinker<COccurrenceUnsatisfiableCacheEntry *> *incCacheEntriesLinker;
112
113 QList<CCacheValue> lastUnsatItems;
114
115 };
116
117 }; // end namespace Cache
118
119 }; // end namespace Kernel
120
121 }; // end namespace Reasoner
122
123 }; // end namespace Konclude
124
125 #endif // KONCLUDE_REASONER_KERNEL_CACHE_COCCURRENCEUNSATISFIABLECACHEREADER_H