tin  1.5.9
tsm::runtime::input_port< Event, Sink > Struct Template Reference

#include <actor.h>

Collaboration diagram for tsm::runtime::input_port< Event, Sink >:
Collaboration graph

Public Types

using event_type = Event
 Event type accepted by this port. More...
 
using sink_type = Sink
 Actor or adapter type referenced by this port. More...
 

Public Member Functions

constexpr input_port (Sink &sink)
 
bool try_send (Event const &event) const requires actor_sink< Sink
 
bool try_send (Event &&event) const requires actor_sink< Sink
 
bool send_event (Event const &event) const requires actor_sink< Sink
 Alias for try_send(event) that satisfies event-sink shaped code. More...
 
bool send_event (Event &&event) const requires actor_sink< Sink
 Move-sending alias for try_send(std::move(event)). More...
 

Public Attributes

bool Event
 

Detailed Description

template<typename Event, typename Sink>
struct tsm::runtime::input_port< Event, Sink >

Non-owning typed ingress view for an actor sink.

input_port narrows access to one event type. It is useful when wiring actors because a link only needs to send a specific value into a specific sink, not expose the sink's entire API.

Member Typedef Documentation

◆ event_type

template<typename Event , typename Sink >
using tsm::runtime::input_port< Event, Sink >::event_type = Event

Event type accepted by this port.

◆ sink_type

template<typename Event , typename Sink >
using tsm::runtime::input_port< Event, Sink >::sink_type = Sink

Actor or adapter type referenced by this port.

Constructor & Destructor Documentation

◆ input_port()

template<typename Event , typename Sink >
constexpr tsm::runtime::input_port< Event, Sink >::input_port ( Sink &  sink)
inlineexplicitconstexpr

Bind the port to an existing sink.

The caller owns sink; the port stores only a pointer and must not outlive the referenced object.

Member Function Documentation

◆ send_event() [1/2]

template<typename Event , typename Sink >
bool tsm::runtime::input_port< Event, Sink >::send_event ( Event &&  event) const

Move-sending alias for try_send(std::move(event)).

◆ send_event() [2/2]

template<typename Event , typename Sink >
bool tsm::runtime::input_port< Event, Sink >::send_event ( Event const &  event) const

Alias for try_send(event) that satisfies event-sink shaped code.

◆ try_send() [1/2]

template<typename Event , typename Sink >
bool tsm::runtime::input_port< Event, Sink >::try_send ( Event &&  event) const

Try to move an event into the sink.

Returns true when the sink accepts the event and false when the sink rejects it. On rejection the event has been passed to the sink API, so callers should treat moved-from state normally for Event.

◆ try_send() [2/2]

template<typename Event , typename Sink >
bool tsm::runtime::input_port< Event, Sink >::try_send ( Event const &  event) const

Try to send a const event into the sink.

Returns true when the sink accepts the event and false when the sink rejects it, usually because its bounded storage is full.

Member Data Documentation

◆ Event

template<typename Event , typename Sink >
bool tsm::runtime::input_port< Event, Sink >::Event
Initial value:
{
return sink_->send_event(event)

The documentation for this struct was generated from the following file: