![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Outgoing message endpoint attached to a node. More...
#include <dfx-core/ports/OutputPort.hpp>
Public Member Functions | |
| OutputPort (Id id, NodeWPtr node, std::string name, Kind kind, MimeType mimeType=MimeType::Any, std::optional< bool > allowsMimeTypePropagation=std::nullopt) | |
| Construct an output port. | |
| MimeType const & | mimeType () const noexcept |
| Declared MIME type emitted by this port. | |
| bool | isMimeTypeSupported (MimeType const &mimeType) const noexcept |
| Test whether a MIME type is compatible with this port. | |
| void | sendMessage (MessagePtr msg) |
| Send a message through this output port. | |
| Public Member Functions inherited from dfx::Core::Port | |
| ENABLE_DEFAULT_MOVE_DISABLE_COPY (Port) | |
| Move is allowed, copy is disabled. | |
| virtual | ~Port () |
| Virtual destructor for inheritance. | |
| NodePtr | node () const noexcept |
| Get the owning node. | |
| template<DerivedFromPort T> | |
| T & | as () noexcept |
| Unchecked cast to a derived port type. | |
| template<DerivedFromPort T> | |
| T const & | as () const noexcept |
| Unchecked cast to a derived port type. | |
| Id | id () const noexcept |
| Get the port id. | |
| std::string const & | name () const noexcept |
| Get the port name. | |
| Mode | mode () const noexcept |
| Get the port mode. | |
| Kind | kind () const noexcept |
| Get the port kind. | |
| bool | isInput () const noexcept |
| Check is this is an input port. | |
| bool | isOutput () const noexcept |
| Check is this is an output port. | |
| std::optional< bool > | allowsMimeTypePropagation () const noexcept |
| Check if this node allow mime-type propagation. | |
| void | addChannel (ChannelPtr channel) |
| Attach a channel to this port. | |
| void | removeChannel (ChannelPtr channel) |
| Detach a channel from this port. If the channel is not present, this is a no-op. | |
| bool | hasChannel (ChannelPtr channel) const noexcept |
| Check whether a channel is attached to this port. | |
| std::size_t | channelCount () const noexcept |
| Number of attached channels. | |
| ChannelPtr | channel (std::size_t index) const |
| Get the attached channel at the given index. | |
| void | registerHook (Hooks::Port *hook) |
| Register a hook on this port. | |
| void | deregisterHook (Hooks::Port *hook) |
| Deregister a hook from this port. If the hook is not registered, this is a no-op. | |
Additional Inherited Members | |
| Public Types inherited from dfx::Core::Port | |
| enum class | Mode { Input , Output } |
| Port direction. More... | |
| using | Id = uint32_t |
| Identifier type of a port (unique within a node by not unique accross a graph). | |
| Static Public Member Functions inherited from dfx::Core::Port | |
| static void | validatePortName (std::string_view name) |
| Validate a port name according to dfx rules. | |
| Protected Member Functions inherited from dfx::Core::Port | |
| Port (Id id, NodeWPtr node, Mode mode, Kind kind, std::string name, std::optional< bool > allowsMimeTypePropagation) | |
| Construct a port. | |
| Protected Attributes inherited from dfx::Core::Port | |
| std::vector< Hooks::Port * > | hooks |
| Registered port hooks. Stored as raw pointers. Managed via registerHook and deregisterHook. | |
Outgoing message endpoint attached to a node.
This minimizes cloning while keeping each channel independent (each delivery gets a distinct message object).
| dfx::Core::OutputPort::OutputPort | ( | Id | id, |
| NodeWPtr | node, | ||
| std::string | name, | ||
| Kind | kind, | ||
| MimeType | mimeType = MimeType::Any, | ||
| std::optional< bool > | allowsMimeTypePropagation = std::nullopt ) |
Construct an output port.
| id | Port id (unique within the owning node). |
| node | Owning node (weak reference). |
| name | Port name. |
| kind | Connectivity domain (data/control "network"). |
| mimeType | Declared MIME type emitted by this port (defaults to MimeType::Any). |
| allowsMimeTypePropagation | Optional override for MIME type propagation. |
|
noexcept |
Test whether a MIME type is compatible with this port.
Compatibility rules implemented:
mimeType is Any, returns true.
|
inlinenoexcept |
Declared MIME type emitted by this port.
| void dfx::Core::OutputPort::sendMessage | ( | MessagePtr | msg | ) |
Send a message through this output port.
Delivery behavior:
| msg | Message to broadcast to all connected channels. |