15#include <nlohmann/json.hpp>
18#include "messages/Message.hpp"
19#include "transports/destinations/DestinationTransport.hpp"
20#include "transports/sources/SourceTransport.hpp"
21#include <dfx-hooks/Delivery.hpp>
59 friend class SourceTransport;
77 Id id() const noexcept {
return _id; }
87 DestinationTransportPtr
const &
destination() const noexcept {
return _destination; }
97 { _deliveryHook = hook; }
131 DestinationTransportPtr _destination;
Convenience macros to explicitly control copy and move semantics.
DFX_DISABLE_COPY_AND_MOVE(Channel)
Channel is not copiable nor movable.
uint32_t Id
Identifier type (unique within a graph instance, by convention).
Definition Channel.hpp:63
Channel(Id id, SourceTransportPtr source, DestinationTransportPtr destination)
Construct a channel linking one input port to one output port.
DestinationTransportPtr const & destination() const noexcept
Get the destination transport a.k.a. the InputPort.
Definition Channel.hpp:87
void setDeliveryHook(Hooks::Delivery *hook)
Set the optional delivery hook for this channel.
Definition Channel.hpp:96
Id id() const noexcept
Get the channel id.
Definition Channel.hpp:77
bool transmit(MessagePtr message)
Transmits a message from the source transport to the destination transport.
int64_t pendingMessageCount() const
Return the number of pending message in this channel or -1 if unknown.
SourceTransportPtr const & source() const noexcept
Get the source transport a.k.a. the OutputPort.
Definition Channel.hpp:84
Hook interface invoked around message enqueue in an dfx::Core::Channel.
Definition Delivery.hpp:39
Definition Channel.hpp:25
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
std::shared_ptr< Channel > ChannelPtr
Shared ownership handle for channels.
Definition Channel.hpp:137
std::unique_ptr< SourceTransport > SourceTransportPtr
Unique ownership handle for SourceTransport.
Definition SourceTransport.hpp:48