Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::system::SharedMemory Class Referencefinal

Shared Memory Class. More...

#include <SharedMemory.h>

Public Types

using Ptr = std::unique_ptr<SharedMemory>
 

Public Member Functions

 ~SharedMemory () noexcept
 Destructor.
 
void * getBuffer () noexcept
 

Static Public Member Functions

static SharedMemory::Ptr create (const char *name, size_t size) noexcept
 
static Result< Ptr, ErrorCodecreateEx (const char *name, size_t size) noexcept
 
static SharedMemory::Ptr use (const char *name) noexcept
 
static Result< Ptr, ErrorCodeuseEx (const char *name) noexcept
 

Private Member Functions

 SharedMemory ()=default
 

Static Private Member Functions

static key_t name2key (const char *name) noexcept
 

Private Attributes

int id {}
 
void * buffer = nullptr
 
bool isOwner {}
 

Detailed Description

Shared Memory Class.

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ ~SharedMemory()

SharedMemory::~SharedMemory ( )
noexcept

Destructor.

References buffer, and isOwner.

◆ SharedMemory()

sese::system::SharedMemory::SharedMemory ( )
privatedefault

Member Function Documentation

◆ create()

SharedMemory::Ptr SharedMemory::create ( const char * name,
size_t size )
staticnoexcept

Create a shared memory block

Parameters
nameShared memory name
sizeShared memory size
Returns
Pointer to the shared memory object
Return values
nullptrCreation failed

References MAKE_UNIQUE_PRIVATE.

Referenced by sese::system::IPCChannel::create().

◆ createEx()

sese::Result< sese::system::SharedMemory::Ptr, sese::ErrorCode > sese::system::SharedMemory::createEx ( const char * name,
size_t size )
staticnoexcept

◆ getBuffer()

void * SharedMemory::getBuffer ( )
noexcept

Get the actual address of the shared memory

Returns
Shared memory block

References buffer.

◆ name2key()

key_t SharedMemory::name2key ( const char * name)
staticprivatenoexcept

◆ use()

SharedMemory::Ptr SharedMemory::use ( const char * name)
staticnoexcept

Use an existing shared memory block

Parameters
nameShared memory name
Returns
Pointer to the shared memory object
Return values
nullptrAcquisition failed

References MAKE_UNIQUE_PRIVATE.

Referenced by sese::system::IPCChannel::use().

◆ useEx()

sese::Result< sese::system::SharedMemory::Ptr, sese::ErrorCode > sese::system::SharedMemory::useEx ( const char * name)
staticnoexcept

Member Data Documentation

◆ buffer

void* sese::system::SharedMemory::buffer = nullptr
private

Referenced by getBuffer(), and ~SharedMemory().

◆ id

int sese::system::SharedMemory::id {}
private

◆ isOwner

bool sese::system::SharedMemory::isOwner {}
private

Referenced by ~SharedMemory().


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