Debian Codegraph @

Source/Reasoner/Kernel/Cache/CReuseCompletionGraphCache.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_CREUSECOMPLETIONGRAPHCACHE_H
22 #define KONCLUDE_REASONER_KERNEL_CACHE_CREUSECOMPLETIONGRAPHCACHE_H
23
24 // Libraries includes
25 #include <QHash>
26 #include <QMutex>
27 #include <QSemaphore>
28
29 // Namespace includes
30 #include "CacheSettings.h"
31 #include "CCompletionGraphCache.h"
32 #include "CReuseCompletionGraphCacheReader.h"
33 #include "CReuseCompletionGraphCacheWriter.h"
34 #include "CReuseCompletionGraphCacheContext.h"
35 #include "CReuseCompletionGraphCacheSlotItem.h"
36 #include "CReuseCompletionGraphCacheEntryWriteData.h"
37 #include "CReuseCompletionGraphCacheEntryExpandWriteData.h"
38
39
40 // Other includes
41 #include "Concurrent/CThread.h"
42
43 #include "Reasoner/Kernel/Cache/Events/CWriteCachedDataEvent.h"
44 #include "Reasoner/Kernel/Cache/Events/CWriteExpandCachedEvent.h"
45 #include "Reasoner/Kernel/Cache/Events/CWriteSatisfiableBranchCachedEvent.h"
46
47 #include "Utilities/Memory/CObjectMemoryPoolAllocator.h"
48 #include "Utilities/Memory/CObjectParameterizingAllocator.h"
49 #include "Utilities/Memory/CMemoryPoolContainerAllocationManager.h"
50
51 #include "Context/CContextBase.h"
52
53
54 // Logger includes
55 #include "Logger/CLogger.h"
56
57
58
59 namespace Konclude {
60
61 using namespace Concurrent;
62 using namespace Context;
63 using namespace Utilities::Memory;
64
65 namespace Reasoner {
66
67 namespace Kernel {
68
69 namespace Cache {
70
71 using namespace Events;
72
73 /*!
74 *
75 * \class CReuseCompletionGraphCache
76 * \author Andreas Steigmiller
77 * \version 0.1
78 * \brief TODO
79 *
80 */
81 class CReuseCompletionGraphCache : public CThread, public CCompletionGraphCache {
82 // public methods
83 public:
84 //! Constructor
85 CReuseCompletionGraphCache(QString threadIdentifierName = "Reuse-Completion-Graph-Cache", CWatchDog *watchDogThread = 0);
86
87 //! Destructor
88 virtual ~CReuseCompletionGraphCache();
89
90 CReuseCompletionGraphCacheReader* createCacheReader();
91 CReuseCompletionGraphCacheWriter* createCacheWriter();
92
93 CReuseCompletionGraphCache* writeExpandCache(CReuseCompletionGraphCacheEntryWriteData* writeData, CMemoryPool* memoryPools);
94
95
96 // protected methods
97 protected:
98 void createReaderSlotUpdate(CReuseCompletionGraphCacheContext* context);
99 void cleanUnusedSlots(CReuseCompletionGraphCacheContext* context);
100
101
102 virtual bool processCustomsEvents(QEvent::Type type, CCustomEvent *event);
103
104 void writeExpandCacheData(CReuseCompletionGraphCacheContext* context, CCACHINGLIST<CCacheValue>* cacheList, CCACHINGLIST<CCacheValue>* minimalCacheList, CSatisfiableCalculationJobInstantiation* jobInst);
105
106 // protected variables
107 protected:
108 CReuseCompletionGraphCacheSlotItem* mSlotLinker;
109 CReuseCompletionGraphCacheReader* mReaderLinker;
110 QMutex mReaderSyncMutex;
111
112 CReuseCompletionGraphCompatibilityEntryHash* mEntyHash;
113 CCACHINGLIST<CReuseCompletionGraphCacheEntry*>* mEntyList;
114 cint64 mEntryCount;
115
116
117 CReuseCompletionGraphCacheContext mContext;
118
119 // private methods
120 private:
121
122 // private variables
123 private:
124
125 };
126
127 }; // end namespace Cache
128
129 }; // end namespace Kernel
130
131 }; // end namespace Reasoner
132
133 }; // end namespace Konclude
134
135 #endif // KONCLUDE_REASONER_KERNEL_CACHE_CREUSECOMPLETIONGRAPHCACHE_H