lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::ShmSegmentAccessor Class Reference

#include <ShmSegmentAccessor.h>

Classes

class  Allocator
 

Public Member Functions

 ShmSegmentAccessor (Allocator &allocator) noexcept
 
void * allocate (std::size_t bytes) const
 
void deallocate (void *pointer) const
 

Detailed Description

Typed access to the allocator of a shared memory segment.

The accessor is a small value type (one pointer) that keeps the boost interprocess headers out of EventBus.h: objects stored in shared memory hold a copy of the accessor, while the process local allocator it points to is owned by SharedMemoryService. Only the raw block allocation itself is untyped, everything above it stays typed.

Copying is intentional: the copy lives inside the shared memory object and therefore keeps a stable address for the whole lifetime of that object, independent of the process that created it.

Constructor & Destructor Documentation

◆ ShmSegmentAccessor()

lintel::ShmSegmentAccessor::ShmSegmentAccessor ( Allocator &  allocator)
inlineexplicitnoexcept
Parameters
allocatorprocess local allocator of the segment

Member Function Documentation

◆ allocate()

void * lintel::ShmSegmentAccessor::allocate ( std::size_t  bytes) const
inline
Parameters
bytesto allocate from the segment
Returns
pointer to the allocated block

◆ deallocate()

void lintel::ShmSegmentAccessor::deallocate ( void *  pointer) const
inline
Parameters
pointerblock previously returned by allocate

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