High-level typed inter-process communication channel for Corium events. Encapsulates OS shared memory allocation and lock-free event dispatching.
More...
#include <IpcChannel.hpp>
|
| bool | attach (const std::string &channelName) noexcept |
| | Attach to an existing shared memory channel as a client process.
|
| |
| bool | bindRaw (void *buffer, bool isCreator=true) noexcept |
| | Bind channel directly to a raw memory buffer (e.g. multi-core embedded SRAM).
|
| |
| constexpr std::size_t | capacity () const noexcept |
| | Configured capacity of the channel.
|
| |
| bool | create (const std::string &channelName) noexcept |
| | Create a new shared memory channel as the host/creator process.
|
| |
| bool | empty () const noexcept |
| | Check if channel is empty.
|
| |
| | IpcChannel ()=default |
| |
| bool | isValid () const noexcept |
| | Check if channel is open and valid.
|
| |
| template<typename EventType > |
| bool | post (EventType &&event) noexcept |
| | Post an event into the shared memory queue for remote processes. Lock-free, zero-allocation, multi-producer safe.
|
| |
| template<typename SinkType > |
| std::size_t | pumpInto (const SinkType &sink, std::size_t maxEvents=0) |
| | Drain incoming shared memory events into a target event sink.
|
| |
| bool | tryPop (EventVariant &outEvent) noexcept |
| | Pop one event from the shared queue. Single-consumer safe.
|
| |
| void | unlink () noexcept |
| | Destroy the channel and remove shared memory from OS.
|
| |
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
class corium::ipc::IpcChannel< EventVariant, Capacity >
High-level typed inter-process communication channel for Corium events. Encapsulates OS shared memory allocation and lock-free event dispatching.
- Template Parameters
-
| EventVariant | Supported event variant list (must be trivially copyable or POD). |
| Capacity | Ring buffer capacity (power of 2, default 256). |
◆ QueueType
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
◆ IpcChannel()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
◆ attach()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Attach to an existing shared memory channel as a client process.
- Parameters
-
| channelName | Unique system name. |
- Returns
- true on success, false otherwise.
◆ bindRaw()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Bind channel directly to a raw memory buffer (e.g. multi-core embedded SRAM).
- Parameters
-
| buffer | Pointer to raw memory region. |
| isCreator | If true, initializes queue headers; if false, attaches to existing queue. |
- Returns
- true if valid, false if buffer is null.
◆ capacity()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Configured capacity of the channel.
◆ create()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Create a new shared memory channel as the host/creator process.
- Parameters
-
| channelName | Unique system name (e.g. "/corium_robot_telemetry"). |
- Returns
- true on success, false otherwise.
◆ empty()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Check if channel is empty.
◆ isValid()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Check if channel is open and valid.
◆ post()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
template<typename EventType >
Post an event into the shared memory queue for remote processes. Lock-free, zero-allocation, multi-producer safe.
- Template Parameters
-
| EventType | Strongly-typed event type. |
- Parameters
-
- Returns
- true if pushed, false if shared queue is full.
◆ pumpInto()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
template<typename SinkType >
| std::size_t corium::ipc::IpcChannel< EventVariant, Capacity >::pumpInto |
( |
const SinkType & |
sink, |
|
|
std::size_t |
maxEvents = 0 |
|
) |
| |
|
inline |
Drain incoming shared memory events into a target event sink.
- Template Parameters
-
| SinkType | Target EventSink or compatible sink. |
- Parameters
-
| sink | Target sink instance. |
| maxEvents | Maximum events to drain (0 = drain all pending). |
- Returns
- Number of events successfully transferred into local runtime.
◆ tryPop()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Pop one event from the shared queue. Single-consumer safe.
- Parameters
-
| outEvent | Reference populated with popped event variant. |
- Returns
- true if an event was popped, false if queue is empty.
◆ unlink()
template<typename EventVariant = DefaultEvents, std::size_t Capacity = 256>
Destroy the channel and remove shared memory from OS.
The documentation for this class was generated from the following file: