theCore C++ embedded framework
pool_mock Class Reference
Inheritance diagram for pool_mock:
Collaboration diagram for pool_mock:

Public Member Functions

 pool_mock ()
 
 ~pool_mock ()
 
uint8_t * real_alloc (size_t n, size_t align, size_t obj_sz) override
 Allocates chunk with respect to given alingment. More...
 
void real_dealloc (uint8_t *p, size_t n, size_t obj_sz) override
 Deallocates chunk of given address and length. More...
 
- Public Member Functions inherited from ecl::pool_base
template<typename T >
T * aligned_alloc (size_t n)
 Allocates memory suitable for type T, with respect to its aligment. More...
 
template<typename T >
void deallocate (T *p, size_t n)
 Deallocates memory, previously allocated by aligned_alloc. More...
 
virtual ~pool_base ()
 Destroys a pool. More...
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ pool_mock()

pool_mock::pool_mock ( )
inline

◆ ~pool_mock()

pool_mock::~pool_mock ( )
inline

Member Function Documentation

◆ real_alloc()

uint8_t* pool_mock::real_alloc ( size_t  n,
size_t  align,
size_t  obj_sz 
)
inlineoverridevirtual

Allocates chunk with respect to given alingment.

Parameters
[in]nObject count.
[in]alignRequired align.
[in]obj_szSize of single object.
Returns
nullptr if there is no space for given type and count in the pool. Valid pointer returned otherwise.
See also
aligned_alloc()

Implements ecl::pool_base.

◆ real_dealloc()

void pool_mock::real_dealloc ( uint8_t *  p,
size_t  n,
size_t  obj_sz 
)
inlineoverridevirtual

Deallocates chunk of given address and length.

Length of chunk is determined by multiplication count of objects by object size.

Parameters
[in]pAddress of a chunk. Must be valid address, returned Previously by real_alloc().
[in]nObjects count. Must be the same as passed to real_alloc() when given chunk was allocated.
[in]obj_szSize of single object. Must be the same as passed to real_alloc() when given chunk was allocated.
See also
deallocate()

Implements ecl::pool_base.


The documentation for this class was generated from the following file: