Sese Framework
2.3.0
A cross-platform framework
|
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< Message > | read (uint32_t id) |
Static Public Member Functions | |
static IPCChannel::Ptr | create (const std::string &name, size_t buffer_size) |
static Result< Ptr, ErrorCode > | createEx (const std::string &name, size_t buffer_size) |
static IPCChannel::Ptr | use (const std::string &name) |
static Result< Ptr, ErrorCode > | useEx (const std::string &name) |
Private Member Functions | |
IPCChannel ()=default | |
Private Attributes | |
MemInfo * | mem_info {} |
void * | buffer {} |
Semaphore::Ptr | semaphore {} |
SharedMemory::Ptr | shared_memory {} |
IPC Channel.
using sese::system::IPCChannel::Ptr = std::unique_ptr<IPCChannel> |
|
privatedefault |
|
static |
Create an IPC channel
name | Channel name |
buffer_size | Size of the shared memory |
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().
|
static |
References create(), sese::getErrorCode(), and sese::getErrorString().
std::list< Message > IPCChannel::read | ( | uint32_t | id | ) |
Read data from the IPC channel with the specified id
id | Identifier |
References buffer, mem_info, semaphore, and sese::system::MemInfo::tail.
|
static |
Use an existing IPC channel
name | Channel name |
References buffer, sese::system::Semaphore::create(), MAKE_UNIQUE_PRIVATE, mem_info, and sese::system::SharedMemory::use().
Referenced by useEx().
|
static |
References sese::getErrorCode(), sese::getErrorString(), and use().
bool IPCChannel::write | ( | uint32_t | id, |
const std::string & | message ) |
Write data to the IPC channel with the specified id
id | Identifier |
message | Data |
References write().
bool IPCChannel::write | ( | uint32_t | id, |
const void * | data, | ||
uint32_t | length ) |
Write data to the IPC channel with the specified id
id | Identifier |
data | Data |
length | Data size |
References buffer, HEADER_SIZE, mem_info, semaphore, sese::system::MemInfo::tail, and sese::system::MemInfo::total_size.
Referenced by write().
|
private |
|
private |
|
private |
|
private |