◆ StdCppFixedMemoryPool()
StdCppOSWrapper::StdCppFixedMemoryPool::StdCppFixedMemoryPool |
( |
std::size_t |
blockSize, |
|
|
std::size_t |
maxBlocks, |
|
|
std::size_t |
memoryPoolSize, |
|
|
void * |
memoryPoolAddress |
|
) |
| |
|
inlineexplicit |
◆ ~StdCppFixedMemoryPool()
StdCppOSWrapper::StdCppFixedMemoryPool::~StdCppFixedMemoryPool |
( |
| ) |
|
|
inline |
◆ allocate()
void * StdCppOSWrapper::StdCppFixedMemoryPool::allocate |
( |
| ) |
|
|
inlinevirtual |
◆ allocateMemory()
OSWrapper::Error StdCppOSWrapper::StdCppFixedMemoryPool::allocateMemory |
( |
void ** |
memory | ) |
|
|
inlinevirtual |
Block the current thread until a memory block is allocated from this FixedMemoryPool.
- Parameters
-
[out] | memory | Pointer of pointer that stores the allocated memory |
- Return values
-
OK | Success. A memory is allocated |
InvalidParameter | Parameter memory is null pointer |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
OtherError | Not implemented in concrete class |
- Note
- Call deallocate() to release a memory block allocated by this method
-
Same as timedAllocateMemory(memory, Timeout::FOREVER)
Reimplemented from OSWrapper::FixedMemoryPool.
◆ deallocate()
void StdCppOSWrapper::StdCppFixedMemoryPool::deallocate |
( |
void * |
p | ) |
|
|
inlinevirtual |
Release the allocated block.
- Parameters
-
p | Pointer of allocated block |
- Note
- If p is null pointer, do nothing.
Implements OSWrapper::FixedMemoryPool.
◆ getBlockSize()
std::size_t StdCppOSWrapper::StdCppFixedMemoryPool::getBlockSize |
( |
| ) |
const |
|
inlinevirtual |
◆ getMaxNumberOfBlocks()
std::size_t StdCppOSWrapper::StdCppFixedMemoryPool::getMaxNumberOfBlocks |
( |
| ) |
const |
|
inlinevirtual |
Get the max number of blocks in this FixedMemoryPool.
- Returns
- Max number of blocks
- Note
- If the concrete class does not implement this method, this method returns 0
Reimplemented from OSWrapper::FixedMemoryPool.
◆ getNumberOfAvailableBlocks()
std::size_t StdCppOSWrapper::StdCppFixedMemoryPool::getNumberOfAvailableBlocks |
( |
| ) |
const |
|
inlinevirtual |
Get the remaining number of available blocks in this FixedMemoryPool.
- Returns
- Remaining number of available blocks
- Note
- If the concrete class does not implement this method, this method returns 0
Reimplemented from OSWrapper::FixedMemoryPool.
◆ timedAllocateMemory()
Block the current thread until a memory block is allocated from this FixedMemoryPool but only within the limited time.
- Parameters
-
[out] | memory | Pointer of pointer that stores the allocated memory |
| tmout | The limited time |
- Return values
-
OK | Success. A memory is allocated |
TimedOut | The limited time was elapsed |
InvalidParameter | Parameter memory is null pointer |
CalledByNonThread | Called from non thread context (interrupt handler, timer, etc) |
OtherError | Not implemented in concrete class |
- Note
- Call deallocate() to release a memory block allocated by this method
-
If tmout is Timeout::POLLING then this method tries to allocate a memory block without blocking.
-
If tmout is Timeout::FOREVER then this method waits forever until a memory block is allocated.
Reimplemented from OSWrapper::FixedMemoryPool.
◆ tryAllocateMemory()
OSWrapper::Error StdCppOSWrapper::StdCppFixedMemoryPool::tryAllocateMemory |
( |
void ** |
memory | ) |
|
|
inlinevirtual |
Try to allocate a memory block from this FixedMemoryPool without blocking.
- Parameters
-
[out] | memory | Pointer of pointer that stores the allocated memory |
- Return values
-
OK | Success. A memory is allocated |
TimedOut | Failed. No memory blocks available |
InvalidParameter | Parameter memory is null pointer |
OtherError | Not implemented in concrete class |
- Note
- Call deallocate() to release a memory block allocated by this method
-
Same as timedAllocateMemory(memory, Timeout::POLLING)
Reimplemented from OSWrapper::FixedMemoryPool.
The documentation for this class was generated from the following file: