Debian Codegraph @

Source/Reasoner/Kernel/Cache/COccurrenceUnsatisfiableCacheUpdateSlotItem.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_COCCURRENCEUNSATISFIABLECACHEUPDATESLOTITEM_H
22 #define KONCLUDE_REASONER_KERNEL_CACHE_COCCURRENCEUNSATISFIABLECACHEUPDATESLOTITEM_H
23
24 // Libraries includes
25 #include <QLinkedListIterator>
26 #include <QMutex>
27 #include <QSet>
28 #include <QHash>
29 #include <QAtomicInt>
30
31 // Namespace includes
32 #include "CacheSettings.h"
33 #include "CCacheValue.h"
34 #include "COccurrenceUnsatisfiableCacheEntry.h"
35 #include "COccurrenceUnsatisfiableCacheReader.h"
36
37
38 // Other includes
39 #include "Utilities/CMemoryManager.hpp"
40 #include "Utilities/CDblLinker.hpp"
41
42 // Logger includes
43 #include "Logger/CLogger.h"
44
45
46 namespace Konclude {
47
48 using namespace Utilities;
49
50 namespace Reasoner {
51
52 namespace Kernel {
53
54 namespace Cache {
55
56 /*!
57 *
58 * \class COccurrenceUnsatisfiableCacheUpdateSlotItem
59 * \author Andreas Steigmiller
60 * \version 0.1
61 * \brief TODO
62 *
63 */
64 class COccurrenceUnsatisfiableCacheUpdateSlotItem {
65 // public methods
66 public:
67 //! Constructor
68 COccurrenceUnsatisfiableCacheUpdateSlotItem(qint64 updateSlotIndex);
69
70 //! Destructor
71 virtual ~COccurrenceUnsatisfiableCacheUpdateSlotItem();
72
73 bool incReader();
74 bool incReader(cint64 incCount);
75 bool decReader();
76
77 void addCacheEntry(COccurrenceUnsatisfiableCacheEntry *cacheEntry);
78 void addCacheEntriesHash(COccurrenceUnsatisfiableCacheEntriesHash *cacheEntriesHash);
79
80 void activateSlotUpdateItems();
81 void cleanSlotUpdateItems();
82
83 qint64 getSlotIndex();
84
85 bool hasCacheReaders();
86
87
88 // protected methods
89 protected:
90
91
92 // private methods
93 private:
94
95 // private variables
96 private:
97 QSet<COccurrenceUnsatisfiableCacheEntry *> updatedEntrySet;
98 QLinkedList<COccurrenceUnsatisfiableCacheEntriesHash *> updatedHashesList;
99
100 QAtomicInt mReaderSharingCount;
101 bool mReaderUsing;
102
103 qint64 readerCount;
104 QMutex readerSyncMutex;
105
106 qint64 slotIndex;
107
108 };
109
110 }; // end namespace Cache
111
112 }; // end namespace Kernel
113
114 }; // end namespace Reasoner
115
116 }; // end namespace Konclude
117
118 #endif // KONCLUDE_REASONER_KERNEL_CACHE_COCCURRENCEUNSATISFIABLECACHEUPDATESLOTITEM_H