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

#include <Fw/Types/MmapAllocator.hpp>

Inheritance diagram for Fw::MmapAllocator< C >:
Fw::MemAllocator

Public Member Functions

 MmapAllocator (int mmap_flags=MAP_PRIVATE|MAP_ANONYMOUS)
 
virtual ~MmapAllocator ()
 Destructor with no arguments. More...
 
void * allocate (const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t)) override
 
void deallocate (const FwEnumStoreType identifier, void *ptr) override
 
- Public Member Functions inherited from Fw::MemAllocator
void * allocate (const FwEnumStoreType identifier, FwSizeType &size, FwSizeType alignment=alignof(std::max_align_t))
 
void * checkedAllocate (const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t))
 
void * checkedAllocate (const FwEnumStoreType identifier, FwSizeType &size, FwSizeType alignment=alignof(std::max_align_t))
 

Additional Inherited Members

- Protected Member Functions inherited from Fw::MemAllocator
 MemAllocator ()
 
virtual ~MemAllocator ()
 

Detailed Description

template<FwSizeType C>
class Fw::MmapAllocator< C >

Fw::MmapAllocator is an implementation of the Fw::MemAllocator interface that backs memory with a read and write capable anonymous memory mapped region.

Parameters
C- Number of allocations supported by this allocator. munmap needs the size of the original mapping. MmapAllocator keeps these sizes in a Map structure with a compile time limit on allocations

Definition at line 33 of file MmapAllocator.hpp.

Constructor & Destructor Documentation

◆ MmapAllocator()

template<FwSizeType C>
Fw::MmapAllocator< C >::MmapAllocator ( int  mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS)
explicit

Constructor with one default argument

Definition at line 66 of file MmapAllocator.hpp.

◆ ~MmapAllocator()

template<FwSizeType C>
Fw::MmapAllocator< C >::~MmapAllocator ( )
virtual

Destructor with no arguments.

Definition at line 69 of file MmapAllocator.hpp.

Member Function Documentation

◆ allocate()

template<FwSizeType C>
void * Fw::MmapAllocator< C >::allocate ( const FwEnumStoreType  identifier,
FwSizeType size,
bool &  recoverable,
FwSizeType  alignment = alignof(std::max_align_t) 
)
overridevirtual

Allocate memory using the mmap allocator

Parameters
identifieridentifier to use with allocation
sizesize of memory to be allocated
recoverable(output) is this memory recoverable after a reset. Always false for mmap.
alignment- alignment requirement for the allocation. Default: maximum alignment defined by C++.
Returns
the pointer to memory. Zero if unable to allocate

Implements Fw::MemAllocator.

Definition at line 72 of file MmapAllocator.hpp.

◆ deallocate()

template<FwSizeType C>
void Fw::MmapAllocator< C >::deallocate ( const FwEnumStoreType  identifier,
void *  ptr 
)
overridevirtual

Deallocation of memory using the mmap allocator

Parameters
identifieridentifier used at allocation
ptrpointer to memory being deallocated

Implements Fw::MemAllocator.

Definition at line 108 of file MmapAllocator.hpp.


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