exchange
Low-latency exchange in C++
Loading...
Searching...
No Matches
exchange::server::SharedMemory Class Reference

#include <shared_memory.hpp>

Public Member Functions

 SharedMemory (bool isOwner, const std::string &segmentName=defaultSegmentName)
 ~SharedMemory ()
boost::interprocess::managed_shared_memory & get ()

Static Public Attributes

static constexpr auto spmcName {"SpmcQueue"}
static constexpr auto mpscName {"MpscQueue"}
static constexpr size_t spmcCapacity = size_t{256} * 1024
static constexpr size_t spmcTotalObjectSize = spmcCapacity + AERON_BROADCAST_BUFFER_TRAILER_LENGTH
static constexpr size_t mpscCapacity = size_t{256} * 1024
static constexpr size_t mpscTotalObjectSize = mpscCapacity + AERON_RB_TRAILER_LENGTH

Detailed Description

Light wrapper around managing a shared memory segment.

Constructor & Destructor Documentation

◆ SharedMemory()

exchange::server::SharedMemory::SharedMemory ( bool isOwner,
const std::string & segmentName = defaultSegmentName )
explicit

Constructor for the shared memory object.

Parameters
isOwnerWhether the caller manages the lifecycle of the shared memory object. The first call in the application should have isOwner = true.
segmentNameThe name of the shared memory segment. Should only be set to a different value when testing.

◆ ~SharedMemory()

exchange::server::SharedMemory::~SharedMemory ( )

Member Function Documentation

◆ get()

boost::interprocess::managed_shared_memory & exchange::server::SharedMemory::get ( )

Getter for the raw Boost shared memory object.

Returns
A reference to the raw Boost shared memory object.
Exceptions
std::logic_errorIf called before the segment is created.
Here is the caller graph for this function:

Member Data Documentation

◆ mpscCapacity

size_t exchange::server::SharedMemory::mpscCapacity = size_t{256} * 1024
staticconstexpr

◆ mpscName

auto exchange::server::SharedMemory::mpscName {"MpscQueue"}
staticconstexpr

◆ mpscTotalObjectSize

size_t exchange::server::SharedMemory::mpscTotalObjectSize = mpscCapacity + AERON_RB_TRAILER_LENGTH
staticconstexpr

◆ spmcCapacity

size_t exchange::server::SharedMemory::spmcCapacity = size_t{256} * 1024
staticconstexpr

◆ spmcName

auto exchange::server::SharedMemory::spmcName {"SpmcQueue"}
staticconstexpr

◆ spmcTotalObjectSize

size_t exchange::server::SharedMemory::spmcTotalObjectSize = spmcCapacity + AERON_BROADCAST_BUFFER_TRAILER_LENGTH
staticconstexpr

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