dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
OutputPort.hpp
1// SPDX-FileCopyrightText: 2025 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11// Project includes
12#include "../messages/Message.hpp"
13#include "Port.hpp"
14
15namespace dfx::Core
16{
46class OutputPort : public Port
47{
48public:
57 OutputPort(Id id, NodeWPtr node, std::string name, Kind kind, MimeType mimeType = MimeType::Any, std::optional<bool> allowsMimeTypePropagation = std::nullopt);
58
60 MimeType const & mimeType() const noexcept { return _mimeType; }
61
68 bool isMimeTypeSupported(MimeType const & mimeType) const noexcept;
69
70public:
88
89private:
90 MimeType _mimeType;
91};
92} // !namespace dfx::Core
MIME type value object.
Definition MimeType.hpp:44
@ Any
"" (empty string), meaning "accept anything"
Definition MimeType.hpp:67
MimeType const & mimeType() const noexcept
Declared MIME type emitted by this port.
Definition OutputPort.hpp:60
void sendMessage(MessagePtr msg)
Send a message through this output port.
bool isMimeTypeSupported(MimeType const &mimeType) const noexcept
Test whether a MIME type is compatible with this port.
OutputPort(Id id, NodeWPtr node, std::string name, Kind kind, MimeType mimeType=MimeType::Any, std::optional< bool > allowsMimeTypePropagation=std::nullopt)
Construct an output port.
Port(Id id, NodeWPtr node, Mode mode, Kind kind, std::string name, std::optional< bool > allowsMimeTypePropagation)
Construct a port.
NodePtr node() const noexcept
Get the owning node.
Definition Port.hpp:87
std::string const & name() const noexcept
Get the port name.
Definition Port.hpp:95
Kind kind() const noexcept
Get the port kind.
Definition Port.hpp:99
std::optional< bool > allowsMimeTypePropagation() const noexcept
Check if this node allow mime-type propagation.
Definition Port.hpp:106
uint32_t Id
Identifier type of a port (unique within a node by not unique accross a graph).
Definition Port.hpp:69
Definition Channel.hpp:22
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
std::weak_ptr< Node > NodeWPtr
Weak pointer type for Nodes.
Definition Node.hpp:63
Kind
Port kind (connection domain).
Definition Kind.hpp:29