Debian Codegraph @

Source/Utilities/Memory/CMemoryPool.cpp

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 #include "CMemoryPool.h"
22
23
24 namespace Konclude {
25
26 namespace Utilities {
27
28 namespace Memory {
29
30
31 CMemoryPool::CMemoryPool() : CLinkerBase<CMemoryPool*,CMemoryPool>(this,nullptr) {
32 mMemoryBlockBegin = 0;
33 mMemoryBlockSize = 0;
34 mMemoryBlockPointer = 0;
35 }
36
37 CMemoryPool::~CMemoryPool() {
38 }
39
40 char* CMemoryPool::getMemoryBlockData() {
41 return mMemoryBlockBegin;
42 }
43
44 cint64 CMemoryPool::getMemoryBlockSize() {
45 return mMemoryBlockSize;
46 }
47
48 char* CMemoryPool::getMemoryBlockPointer() {
49 return mMemoryBlockPointer;
50 }
51
52 char* CMemoryPool::getMemoryBlockEnd() {
53 return mMemoryBlockEnd;
54 }
55
56 CMemoryPool* CMemoryPool::setMemoryBlockData(char* memoryBlock, cint64 memoryBlockSize) {
57 mMemoryBlockBegin = memoryBlock;
58 mMemoryBlockSize = memoryBlockSize;
59 mMemoryBlockEnd = mMemoryBlockBegin + mMemoryBlockSize;
60 mMemoryBlockPointer = mMemoryBlockBegin;
61 return this;
62 }
63
64 CMemoryPool* CMemoryPool::setMemoryBlockPointer(char* memoryBlockPointer) {
65 mMemoryBlockPointer = memoryBlockPointer;
66 return this;
67 }
68
69 CMemoryPool* CMemoryPool::incMemoryBlockPointer(cint64 pointerInc) {
70 mMemoryBlockPointer = (char*)((cint64)mMemoryBlockPointer + pointerInc);
71 return this;
72 }
73
74
75 CMemoryPool* CMemoryPool::resetMemoryBlockPointer() {
76 mMemoryBlockPointer = mMemoryBlockBegin;
77 return this;
78 }
79
80 CMemoryPool* CMemoryPool::getNextMemoryPool() {
81 return getNext();
82 }
83
84 CMemoryPool* CMemoryPool::setNextMemoryPool(CMemoryPool* nextMemoryPool) {
85 CLinkerBase<CMemoryPool*,CMemoryPool>::setNext(nextMemoryPool);
86 return this;
87 }
88
89
90 }; // end namespace Memory
91
92 }; // end namespace Utilities
93
94 }; // end namespace Konclude
95