1#ifndef OS_WRAPPER_FIXED_MEMORY_POOL_H_INCLUDED
2#define OS_WRAPPER_FIXED_MEMORY_POOL_H_INCLUDED
10class FixedMemoryPoolFactory;
37 static FixedMemoryPool*
create(std::size_t blockSize, std::size_t memoryPoolSize,
void* memoryPoolAddress = 0);
Abstract class that has functions of common RTOS's fixed-size memory pool.
Definition FixedMemoryPool.h:23
virtual Error timedAllocateMemory(void **memory, Timeout tmout)
Block the current thread until a memory block is allocated from this FixedMemoryPool but only within ...
Definition FixedMemoryPool.cpp:45
virtual ~FixedMemoryPool()
Definition FixedMemoryPool.h:25
static FixedMemoryPool * create(std::size_t blockSize, std::size_t memoryPoolSize, void *memoryPoolAddress=0)
Create a FixedMemoryPool object.
Definition FixedMemoryPool.cpp:14
virtual void * allocate()=0
Allocate a block from this FixedMemoryPool.
static std::size_t getRequiredMemorySize(std::size_t blockSize, std::size_t numBlocks)
Get the required total memory size for allocation of (blockSize * numBlocks)
Definition FixedMemoryPool.cpp:27
virtual std::size_t getBlockSize() const =0
Get the block size.
virtual Error allocateMemory(void **memory)
Block the current thread until a memory block is allocated from this FixedMemoryPool.
Definition FixedMemoryPool.cpp:33
static void destroy(FixedMemoryPool *p)
Destroy a FixedMemoryPool object.
Definition FixedMemoryPool.cpp:20
virtual std::size_t getNumberOfAvailableBlocks() const
Get the remaining number of available blocks in this FixedMemoryPool.
Definition FixedMemoryPool.cpp:52
virtual std::size_t getMaxNumberOfBlocks() const
Get the max number of blocks in this FixedMemoryPool.
Definition FixedMemoryPool.cpp:57
virtual void deallocate(void *p)=0
Release the allocated block.
virtual Error tryAllocateMemory(void **memory)
Try to allocate a memory block from this FixedMemoryPool without blocking.
Definition FixedMemoryPool.cpp:39
Value object for the timeout.
Definition Timeout.h:11
OSWrapper provides abstract C++ interface of common RTOS: thread, mutex, event flag,...
Definition EventFlag.cpp:5
void registerFixedMemoryPoolFactory(FixedMemoryPoolFactory *factory)
Register the FixedMemoryPoolFactory.
Definition FixedMemoryPool.cpp:9
Error
Kinds of errors of the OS objects.
Definition OSWrapperError.h:9