F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Fw::MemAllocatorRegistry Class Reference

#include <Fw/Types/MemAllocator.hpp>

Public Member Functions

void registerAllocator (const MemoryAllocation::MemoryAllocatorType type, MemAllocator &allocator)
 register an allocator for the given type More...
 
MemAllocatorgetAllocator (const MemoryAllocation::MemoryAllocatorType type)
 
MemAllocatorgetAnAllocator (const MemoryAllocation::MemoryAllocatorType type)
 

Static Public Member Functions

static MemAllocatorRegistrygetInstance ()
 get the singleton registry More...
 

Detailed Description

Definition at line 134 of file MemAllocator.hpp.

Member Function Documentation

◆ getAllocator()

MemAllocator & Fw::MemAllocatorRegistry::getAllocator ( const MemoryAllocation::MemoryAllocatorType  type)

Get an allocator for a type

Return the memory allocator for the given type. It is an error to request an allocator for a type that has not been registered.

Parameters
typethe type of allocator

Definition at line 52 of file MemAllocator.cpp.

◆ getAnAllocator()

MemAllocator & Fw::MemAllocatorRegistry::getAnAllocator ( const MemoryAllocation::MemoryAllocatorType  type)

Get an allocator for a type with default

Return the memory allocator for the given type. If the type has not been registered, then return the allocator registered to MemoryAllocatorType::SYSTEM. It is an error if SYSTEM has not been registered.

Parameters
typethe type of allocator

Definition at line 57 of file MemAllocator.cpp.

◆ getInstance()

MemAllocatorRegistry & Fw::MemAllocatorRegistry::getInstance ( )
static

get the singleton registry

Returns
the singleton registry

Definition at line 47 of file MemAllocator.cpp.

◆ registerAllocator()

void Fw::MemAllocatorRegistry::registerAllocator ( const MemoryAllocation::MemoryAllocatorType  type,
MemAllocator allocator 
)

register an allocator for the given type

This will register an allocator for the given type. If the allocator is already registered it will overwrite.

Warning
allocator must remain valid for duration of the program.
Parameters
typethe type of allocator
allocatorthe allocator. The registry does not take ownership of the allocator.

Definition at line 42 of file MemAllocator.cpp.


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