Debian Codegraph @

Source/Utilities/Memory/CTempMemoryPoolContainerAllocationManager.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_UTILITIES_MEMORY_CTEMPMEMORYPOOLCONTAINERALLOCATIONMANAGER_H
22 #define KONCLUDE_UTILITIES_MEMORY_CTEMPMEMORYPOOLCONTAINERALLOCATIONMANAGER_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "MemorySettings.h"
29 #include "CMemoryAllocationManager.h"
30 #include "CMemoryPoolContainer.h"
31 #include "CMemoryPoolProvider.h"
32
33
34 // Other includes
35
36
37 // Logger includes
38 #include "Logger/CLogger.h"
39
40
41
42 namespace Konclude {
43
44 namespace Utilities {
45
46 namespace Memory {
47
48 /*!
49 *
50 * \class CTempMemoryPoolContainerAllocationManager
51 * \author Andreas Steigmiller
52 * \version 0.1
53 * \brief TODO
54 *
55 */
56 class CTempMemoryPoolContainerAllocationManager : public CMemoryAllocationManager {
57 // public methods
58 public:
59 //! Constructor
60 CTempMemoryPoolContainerAllocationManager(CMemoryPoolContainer* memoryPoolContainer, CMemoryPoolProvider* memoryPoolProvider);
61 CTempMemoryPoolContainerAllocationManager(CMemoryPoolProvider* memoryPoolProvider);
62 CTempMemoryPoolContainerAllocationManager();
63
64 //! Destructor
65 virtual ~CTempMemoryPoolContainerAllocationManager();
66
67
68 CTempMemoryPoolContainerAllocationManager* initTempMemoryPoolContainerAllocationManager(CMemoryPoolContainer* memoryPoolContainer, CMemoryPoolProvider* memoryPoolProvider);
69
70 virtual CMemoryAllocationManager* release(void* address);
71
72 virtual void* allocate(size_t size);
73
74 virtual void* allocateAligned(size_t size, int alignment);
75
76 virtual cint64 getOptimizedMoreAllocationSize(cint64 size);
77
78 static void* allocateMemoryToContainer(size_t size, CMemoryPoolContainer* memoryPoolContainer, CMemoryPoolProvider* memoryPoolProvider);
79
80 CMemoryPool* getMemoryPools();
81 CMemoryPool* takeMemoryPools();
82
83 // protected methods
84 protected:
85 char* getMemoryBlock(cint64 memoryBlockSize);
86 char* getMemoryBlock(cint64 memoryBlockSize, cint64 alignment);
87
88 // protected variables
89 protected:
90 CMemoryPoolProvider* mMemoryPoolProvider;
91 CMemoryPoolContainer* mMemoryPoolContainer;
92
93 CMemoryPoolContainer mTmpMemoryPoolContainer;
94
95
96 cint64 mStatPoolAllocCount;
97 cint64 mStatAllocPoolSize;
98
99
100 // private methods
101 private:
102
103 // private variables
104 private:
105
106 };
107
108 }; // end namespace Memory
109
110 }; // end namespace Utilities
111
112 }; // end namespace Konclude
113
114 #endif // KONCLUDE_UTILITIES_MEMORY_CTEMPMEMORYPOOLCONTAINERALLOCATIONMANAGER_H