Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
posixmemorypool.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
11
#include "
core/types.h
"
12
13
//------------------------------------------------------------------------------
14
namespace
Posix
15
{
16
class
PosixMemoryPool
17
{
18
public
:
20
PosixMemoryPool
();
22
~PosixMemoryPool
();
24
static
uint
ComputeAlignedBlockSize
(
uint
blockSize);
26
void
Setup
(
Memory::HeapType
heapType,
uint
blockSize,
uint
numBlocks);
28
void
*
Alloc
();
30
void
Free
(
void
* ptr);
32
bool
IsPoolBlock
(
void
* ptr)
const
;
34
uint
GetNumBlocks
()
const
;
36
uint
GetBlockSize
()
const
;
38
uint
GetAlignedBlockSize
()
const
;
40
uint
GetPoolSize
()
const
;
42
#if NEBULA_MEMORY_STATS
43
uint
GetAllocCount()
const
;
44
#endif
45
};
46
47
//------------------------------------------------------------------------------
50
#if NEBULA_MEMORY_STATS
51
inline
uint
52
PosixMemoryPool::GetAllocCount()
const
53
{
54
n_error
(
"NOT IMPLEMENTED!\n"
);
55
return
0;
56
}
57
#endif
58
59
//------------------------------------------------------------------------------
62
inline
uint
63
PosixMemoryPool::ComputeAlignedBlockSize
(
uint
blockSize)
64
{
65
n_error
(
"NOT IMPLEMENTED!\n"
);
66
return
0;
67
}
68
69
//------------------------------------------------------------------------------
72
inline
uint
73
PosixMemoryPool::GetNumBlocks
()
const
74
{
75
n_error
(
"NOT IMPLEMENTED!\n"
);
76
return
0;
77
}
78
79
//------------------------------------------------------------------------------
82
inline
uint
83
PosixMemoryPool::GetBlockSize
()
const
84
{
85
n_error
(
"NOT IMPLEMENTED!\n"
);
86
return
0;
87
}
88
89
//------------------------------------------------------------------------------
92
inline
uint
93
PosixMemoryPool::GetAlignedBlockSize
()
const
94
{
95
n_error
(
"NOT IMPLEMENTED!\n"
);
96
return
0;
97
}
98
99
//------------------------------------------------------------------------------
102
inline
uint
103
PosixMemoryPool::GetPoolSize
()
const
104
{
105
n_error
(
"NOT IMPLEMENTED!\n"
);
106
return
0;
107
}
108
109
//------------------------------------------------------------------------------
112
inline
bool
113
PosixMemoryPool::IsPoolBlock
(
void
* ptr)
const
114
{
115
n_error
(
"NOT IMPLEMENTED!\n"
);
116
return
false
;
117
}
118
119
}
// namespace Posix
120
//------------------------------------------------------------------------------
121
Posix::PosixMemoryPool::IsPoolBlock
bool IsPoolBlock(void *ptr) const
return true if block is owned by this pool
Definition
posixmemorypool.h:113
Posix::PosixMemoryPool::GetNumBlocks
uint GetNumBlocks() const
get number of allocated blocks in pool
Definition
posixmemorypool.h:73
Posix::PosixMemoryPool::Free
void Free(void *ptr)
deallocate a block from the pool
Definition
posixmemorypool.cc:52
Posix::PosixMemoryPool::Setup
void Setup(Memory::HeapType heapType, uint blockSize, uint numBlocks)
setup the memory pool
Definition
posixmemorypool.cc:33
Posix::PosixMemoryPool::ComputeAlignedBlockSize
static uint ComputeAlignedBlockSize(uint blockSize)
compute the actual block size including alignment and management data
Definition
posixmemorypool.h:63
Posix::PosixMemoryPool::GetAlignedBlockSize
uint GetAlignedBlockSize() const
get aligned block size
Definition
posixmemorypool.h:93
Posix::PosixMemoryPool::~PosixMemoryPool
~PosixMemoryPool()
destructor
Definition
posixmemorypool.cc:23
Posix::PosixMemoryPool::Alloc
void * Alloc()
allocate a block from the pool (NOTE: returns 0 if pool exhausted!)
Definition
posixmemorypool.cc:42
Posix::PosixMemoryPool::GetPoolSize
uint GetPoolSize() const
get pool size
Definition
posixmemorypool.h:103
Posix::PosixMemoryPool::PosixMemoryPool
PosixMemoryPool()
constructor
Definition
posixmemorypool.cc:15
Posix::PosixMemoryPool::GetBlockSize
uint GetBlockSize() const
get block size
Definition
posixmemorypool.h:83
n_error
void __cdecl n_error(const char *msg,...)
This function is called when a serious situation is encountered which requires abortion of the applic...
Definition
debug.cc:138
Memory::HeapType
HeapType
Heap types are defined here.
Definition
osxmemoryconfig.h:25
Posix
Posix implemention of a read-many write-few lock.
Definition
posixsysfunc.cc:21
types.h
uint
unsigned int uint
Definition
types.h:33
code
foundation
memory
posix
posixmemorypool.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.