qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches

Represents a communication channel between actors. More...

#include <Pipe.h>

Public Member Functions

 Pipe (Pipe const &)=default
Pipeoperator= (Pipe const &)=default
template<typename _Event, typename... _Args>
_Event & push (_Args &&...args) const noexcept
 Push an event to the pipe.
template<typename _Event, typename... _Args>
_Event & allocated_push (std::size_t size, _Args &&...args) const noexcept
 Push an event with pre-allocated size to the pipe.
ActorId getDestination () const noexcept
 Get the destination actor ID.
ActorId getSource () const noexcept
 Get the source actor ID.

Detailed Description

Represents a communication channel between actors.

A Pipe object is returned by Actor::getPipe() and provides a way to send events between actors. It maintains references to both the source and destination actors and the underlying virtual pipe for communication.

Member Function Documentation

◆ push()

template<typename _Event, typename... _Args>
_Event & qb::Pipe::push ( _Args &&... args) const
noexcept

Push an event to the pipe.

Template Parameters
_EventType of event to push
_ArgsArgument types for event construction
Parameters
argsArguments for event construction
Returns
Reference to the constructed event

This function creates a new event of type _Event and sends it through the pipe. The event will be delivered to the destination actor.

◆ allocated_push()

template<typename _Event, typename... _Args>
_Event & qb::Pipe::allocated_push ( std::size_t size,
_Args &&... args ) const
nodiscardnoexcept

Push an event with pre-allocated size to the pipe.

Template Parameters
_EventType of event to push
_ArgsArgument types for event construction
Parameters
sizePre-allocated size for the event
argsArguments for event construction
Returns
Reference to the constructed event

This function creates a new event of type _Event with a pre-allocated size and sends it through the pipe. The event will be delivered to the destination actor.

◆ getDestination()

ActorId qb::Pipe::getDestination ( ) const
inlinenodiscardnoexcept

Get the destination actor ID.

Returns
ActorId of the destination

◆ getSource()

ActorId qb::Pipe::getSource ( ) const
inlinenodiscardnoexcept

Get the source actor ID.

Returns
ActorId of the source