![]() |
GM6000 Digital Heater Controller Build: 20 (Branch = develop)
SDX-1330
|
This template class defines a concrete Allocator that STATICALLY allocates all of its Memory and can allocate up to N instances of the specified Class. More...
This template class defines a concrete Allocator that STATICALLY allocates all of its Memory and can allocate up to N instances of the specified Class.
All of the memory is aligned to size_t boundaries.
NOTES:
1) If you only need memory for ONE instance - use AlignedClass structure in Aligned.h instead. 2) The class is not inherently multi-thread safe. 3) If the requested number of bytes on the allocate() method is greater than the block size (i.e. sizeof(T)), 0 is returned. 4) The class can be deleted. However, it is the responsibility of the Application to properly clean-up/release ALL outstanding block allocations before deleting the SPool instance.
Template args: class "T" is the type of class to allocated int "N" is the number of instances that can be allocate
#include <SPool.h>
Public Member Functions | |
| SPool (bool fatalErrors=false) | |
| Constructor. | |
| void * | allocate (size_t numbytes) |
| See Cpl::Memory::Allocator. | |
| void | release (void *ptr) |
| See Cpl::Memory::Allocator. | |
| size_t | wordSize () const noexcept |
| See Cpl::Memory::Allocator. | |
Public Member Functions inherited from Cpl::Memory::Allocator | |
| size_t | allocatedSizeForNBytes (size_t nbytes) const noexcept |
| Convenience method that determines the actual amount of memory that actually allocated for a successful allocate request of N bytes. | |
| virtual | ~Allocator () |
| Provide a virtual destructor. | |
Public Member Functions inherited from Cpl::Container::Item | |
| bool | insert_ (void *newContainerPtr) |
| Helper method to trap when inserting an item in multiple containers. | |
| bool | isInContainer_ (const void *containerPtr) const noexcept |
| Returns 'true' if the instance is in the specified container. | |
Protected Attributes | |
| AlignedClass< T > | m_blocks [N] |
| Allocate blocks. | |
| Pool_::BlockInfo_ | m_infoBlocks [N] |
| Allocate memory for BlockInfo_ instances. | |
| Pool_ | m_pool |
| My Pool work object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Cpl::Container::Item | |
| static void | remove_ (Item *itemPtr) noexcept |
| Helper method to do the proper 'clean-up' for the multiple-containers-error-trap when removing an item from a container. | |
Public Attributes inherited from Cpl::Container::Item | |
| void * | m_nextPtr_ |
| The link field. | |
| void * | m_inListPtr_ |
| Debug field. | |
Protected Member Functions inherited from Cpl::Container::Item | |
| Item () | |
| Constructor. | |
| Item (const char *) | |
| Constructor used ONLY with the child class MapItem: -->special constructor to allow a Map to be statically allocated. | |
|
inline |
Constructor.
When the 'fatalErrors' argument is set to true, memory errors (e.g. out-of-memory) will generate a Cpl::System::FatalError call. .
|
inlinevirtual |
Implements Cpl::Memory::Allocator.
|
inlinevirtual |
Implements Cpl::Memory::Allocator.
|
inlinevirtualnoexcept |
Implements Cpl::Memory::Allocator.
|
protected |
Allocate blocks.
|
protected |
Allocate memory for BlockInfo_ instances.
|
protected |
My Pool work object.