Zserio C++ runtime library  1.1.0
Built for Zserio 2.15.0
zserio::pmr::MemoryResource Class Referenceabstract

#include <MemoryResource.h>

Inheritance diagram for zserio::pmr::MemoryResource:

Public Member Functions

 MemoryResource ()=default
 
virtual ~MemoryResource ()=default
 
void * allocate (size_t bytes, size_t alignment=alignof(max_align_t))
 
void deallocate (void *storage, size_t bytes, size_t alignment=alignof(max_align_t))
 
bool isEqual (const MemoryResource &other) const noexcept
 
 MemoryResource (const MemoryResource &other)=delete
 
 MemoryResource (MemoryResource &&other)=delete
 
MemoryResourceoperator= (const MemoryResource &other)=delete
 
MemoryResourceoperator= (MemoryResource &&other)=delete
 

Detailed Description

Abstract base class for memory resources which are to be used by polymorphic allocators defined by zserio.

Definition at line 17 of file MemoryResource.h.

Constructor & Destructor Documentation

◆ MemoryResource() [1/3]

zserio::pmr::MemoryResource::MemoryResource ( )
default

Constructor.

◆ ~MemoryResource()

virtual zserio::pmr::MemoryResource::~MemoryResource ( )
virtualdefault

Destructor.

◆ MemoryResource() [2/3]

zserio::pmr::MemoryResource::MemoryResource ( const MemoryResource other)
delete

Copying and moving is disallowed!

◆ MemoryResource() [3/3]

zserio::pmr::MemoryResource::MemoryResource ( MemoryResource &&  other)
delete

Copying and moving is disallowed!

Member Function Documentation

◆ allocate()

void* zserio::pmr::MemoryResource::allocate ( size_t  bytes,
size_t  alignment = alignof(max_align_t) 
)
inline

Allocates storage with a size of at least bytes bytes, aligned to the specified alignment.

Parameters
bytesMinimum number of bytes to allocate.
alignmentRequested alignment.
Returns
Pointer to the allocated storage.

Definition at line 50 of file MemoryResource.h.

◆ deallocate()

void zserio::pmr::MemoryResource::deallocate ( void *  storage,
size_t  bytes,
size_t  alignment = alignof(max_align_t) 
)
inline

Deallocates the storage pointed to by p.

Arguments shall match to prior call to allocate!

Parameters
storagePointer to the storage to deallocate.
bytesNumber of bytes to deallocate.
alignmentRequested alignment.

Definition at line 71 of file MemoryResource.h.

◆ isEqual()

bool zserio::pmr::MemoryResource::isEqual ( const MemoryResource other) const
inlinenoexcept

Compares *this for equality with other.

Two memory resources compare equal if and only if memory allocated from one memory resource can be deallocated from the other and vice versa.

Parameters
otherOther memory resource to compare.
Returns
True when the two resources are equal, false otherwise.

Definition at line 90 of file MemoryResource.h.

◆ operator=() [1/2]

MemoryResource& zserio::pmr::MemoryResource::operator= ( const MemoryResource other)
delete

Copying and moving is disallowed!

◆ operator=() [2/2]

MemoryResource& zserio::pmr::MemoryResource::operator= ( MemoryResource &&  other)
delete

Copying and moving is disallowed!


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