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

IPC Channel. More...

#include <IPC.h>

Public Types

using Ptr = std::unique_ptr<IPCChannel>
 

Public Member Functions

bool write (uint32_t id, const void *data, uint32_t length)
 
bool write (uint32_t id, const std::string &message)
 
std::list< Messageread (uint32_t id)
 

Static Public Member Functions

static IPCChannel::Ptr create (const std::string &name, size_t buffer_size)
 
static Result< Ptr, ErrorCodecreateEx (const std::string &name, size_t buffer_size)
 
static IPCChannel::Ptr use (const std::string &name)
 
static Result< Ptr, ErrorCodeuseEx (const std::string &name)
 

Private Member Functions

 IPCChannel ()=default
 

Private Attributes

MemInfomem_info {}
 
void * buffer {}
 
Semaphore::Ptr semaphore {}
 
SharedMemory::Ptr shared_memory {}
 

Detailed Description

IPC Channel.

Member Typedef Documentation

◆ Ptr

using sese::system::IPCChannel::Ptr = std::unique_ptr<IPCChannel>

Constructor & Destructor Documentation

◆ IPCChannel()

sese::system::IPCChannel::IPCChannel ( )
privatedefault

Member Function Documentation

◆ create()

IPCChannel::Ptr IPCChannel::create ( const std::string & name,
size_t buffer_size )
static

Create an IPC channel

Parameters
nameChannel name
buffer_sizeSize of the shared memory
Returns
IPC channel

References buffer, sese::system::Semaphore::create(), sese::system::SharedMemory::create(), MAKE_UNIQUE_PRIVATE, mem_info, sese::system::MemInfo::tail, and sese::system::MemInfo::total_size.

Referenced by createEx().

◆ createEx()

sese::Result< IPCChannel::Ptr, sese::ErrorCode > IPCChannel::createEx ( const std::string & name,
size_t buffer_size )
static

◆ read()

std::list< Message > IPCChannel::read ( uint32_t id)

Read data from the IPC channel with the specified id

Parameters
idIdentifier
Returns
Data set

References buffer, mem_info, semaphore, and sese::system::MemInfo::tail.

◆ use()

IPCChannel::Ptr IPCChannel::use ( const std::string & name)
static

Use an existing IPC channel

Parameters
nameChannel name
Returns
IPC channel

References buffer, sese::system::Semaphore::create(), MAKE_UNIQUE_PRIVATE, mem_info, and sese::system::SharedMemory::use().

Referenced by useEx().

◆ useEx()

sese::Result< IPCChannel::Ptr, sese::ErrorCode > IPCChannel::useEx ( const std::string & name)
static

◆ write() [1/2]

bool IPCChannel::write ( uint32_t id,
const std::string & message )

Write data to the IPC channel with the specified id

Parameters
idIdentifier
messageData
Returns
Whether the write was successful

References write().

◆ write() [2/2]

bool IPCChannel::write ( uint32_t id,
const void * data,
uint32_t length )

Write data to the IPC channel with the specified id

Parameters
idIdentifier
dataData
lengthData size
Returns
Whether the write was successful

References buffer, HEADER_SIZE, mem_info, semaphore, sese::system::MemInfo::tail, and sese::system::MemInfo::total_size.

Referenced by write().

Member Data Documentation

◆ buffer

void* sese::system::IPCChannel::buffer {}
private

Referenced by create(), read(), use(), and write().

◆ mem_info

MemInfo* sese::system::IPCChannel::mem_info {}
private

Referenced by create(), read(), use(), and write().

◆ semaphore

Semaphore::Ptr sese::system::IPCChannel::semaphore {}
private

Referenced by read(), and write().

◆ shared_memory

SharedMemory::Ptr sese::system::IPCChannel::shared_memory {}
private

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