Debian Codegraph @

Source/Reasoner/Kernel/Cache/COccurrenceStatisticsCache.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_COCCURRENCESTATISTICSCACHE_H
22 #define KONCLUDE_REASONER_KERNEL_CACHE_COCCURRENCESTATISTICSCACHE_H
23
24 // Libraries includes
25 #include <QHash>
26 #include <QSet>
27 #include <QMutex>
28 #include <QSemaphore>
29
30 // Namespace includes
31 #include "CacheSettings.h"
32 #include "COccurrenceStatisticsCacheData.h"
33 #include "COccurrenceStatisticsCacheContext.h"
34 #include "COccurrenceStatisticsCacheReader.h"
35 #include "COccurrenceStatisticsCacheWriter.h"
36 #include "CCacheStatistics.h"
37 #include "COccurrenceStatisticsCacheWriteData.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/CWriteBackendAssociationCachedEvent.h"
45 #include "Reasoner/Kernel/Cache/Events/CRetrieveIncompletelyAssociationCachedEvent.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 #include "Config/CConfiguration.h"
54
55 // Logger includes
56 #include "Logger/CLogger.h"
57
58
59
60
61 namespace Konclude {
62
63 using namespace Concurrent;
64 using namespace Context;
65 using namespace Config;
66 using namespace Utilities::Memory;
67
68 namespace Reasoner {
69
70 namespace Kernel {
71
72 namespace Cache {
73
74 using namespace Events;
75
76 /*!
77 *
78 * \class COccurrenceStatisticsCache
79 * \author Andreas Steigmiller
80 * \version 0.1
81 * \brief TODO
82 *
83 */
84 class COccurrenceStatisticsCache : public CThread {
85 // public methods
86 public:
87 //! Constructor
88 COccurrenceStatisticsCache(CConfiguration* config = nullptr, QString threadIdentifierName = "Occurrence-Statistics-Cache", CWatchDog *watchDogThread = nullptr);
89
90 //! Destructor
91 virtual ~COccurrenceStatisticsCache();
92
93 COccurrenceStatisticsCacheReader* createCacheReader();
94 COccurrenceStatisticsCacheWriter* createCacheWriter();
95
96
97 COccurrenceStatisticsCache* writeCachedData(COccurrenceStatisticsCacheWriteData* writeData, CMemoryPool* memoryPools);
98
99 CCacheStatistics* getCacheStatistics();
100
101
102 // protected methods
103 protected:
104
105
106
107 virtual bool processCustomsEvents(QEvent::Type type, CCustomEvent *event);
108
109
110 // protected variables
111 protected:
112 CConfiguration* mConfig;
113
114 COccurrenceStatisticsCacheData* mCacheData;
115
116
117 cint64 mWriteDataCount;
118
119
120 CCacheStatistics mCacheStat;
121 COccurrenceStatisticsCacheContext mContext;
122
123 // private methods
124 private:
125
126 // private variables
127 private:
128
129 };
130
131 }; // end namespace Cache
132
133 }; // end namespace Kernel
134
135 }; // end namespace Reasoner
136
137 }; // end namespace Konclude
138
139 #endif // KONCLUDE_REASONER_KERNEL_CACHE_COccurrenceStatisticsCache_H