dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
CNode.hpp
1// SPDX-FileCopyrightText: 2026 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 "../../Plugin.hpp"
13#include <dfx-core/Node.hpp>
15
16namespace dfx::Plugins
17{
28class CNode : public Core::Node
29{
30public:
38 CNode(std::string type, Id id, std::string name, Plugin const & plugin, dfx_node_interface_t interface);
40
43
44public:
45 nlohmann::json configSchema() const override { return {}; }
46 nlohmann::json metadata() const override { return {}; }
47
48protected:
53 void startImpl() override;
54
59 void stopImpl() override;
60
66 void initializeImpl(nlohmann::json config) override;
67
75 void handleMessage(Core::InputPort const & port, Core::MessagePtr message) override;
76
77private:
79
80private:
81 Plugin const & _plugin;
82 dfx_node_interface_t _interface{};
83 dfx_node_handle_t _handle{};
84 dfx_poller_api_t _poller{};
85 dfx_node_api_t _api{};
86};
87} // !namespace dfx::Plugins
Convenience macros to explicitly control copy and move semantics.
#define DFX_DISABLE_COPY_AND_MOVE(ClassName)
Disable both copy and move.
Definition CopyMoveControl.hpp:37
Base class for all runtime-executed nodes in a dfx dataflow graph.
void * dfx_node_handle_t
Opaque handle representing a node instance created by the plugin.
Definition PluginInterface.h:69
Incoming message endpoint attached to a node.
Definition InputPort.hpp:57
Abstract base class for all nodes in the dfx runtime.
Definition Node.hpp:94
uint32_t Id
Node identifier type (unique and stable within a graph instance).
Definition Node.hpp:116
nlohmann::json const & config() const noexcept
Get the node configuration.
Definition Node.hpp:141
std::string const & name() const noexcept
Get the node name.
Definition Node.hpp:137
std::string const & type() const noexcept
Get the node type.
Definition Node.hpp:135
void stopImpl() override
Signals the plugin to stop processing.
void initializeImpl(nlohmann::json config) override
Initializes the plugin-side instance.
void startImpl() override
Signals the plugin to start processing.
nlohmann::json configSchema() const override
Return the JSON schema describing the node configuration. Used by the dfx::Graph::NodeFactory / tooli...
Definition CNode.hpp:45
void handleMessage(Core::InputPort const &port, Core::MessagePtr message) override
Dispatches an incoming C++ message to the C-ABI.
~CNode()
Destructor. Invokes the plugin's dfx_node_interface_t::destroy function.
nlohmann::json metadata() const override
Return node metadata (description, categories, ports, etc.). Intended for UI/tooling and discovery.
Definition CNode.hpp:46
CNode(std::string type, Id id, std::string name, Plugin const &plugin, dfx_node_interface_t interface)
Constructs a new CNode proxy.
Manager for a loaded plugin shared library.
Definition Plugin.hpp:38
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
Definition MessageApi.hpp:16
std::unique_ptr< NodeTaskExecutor > NodeTaskExecutorPtr
Unique ownership pointer type for NodeTaskExecutor.
Definition Node.hpp:52
Host-provided services for a node instance.
Definition PluginInterface.h:556
The vtable that a plugin must implement to define a Node.
Definition PluginInterface.h:719
Interface to the host's event loop (Poller).
Definition PluginInterface.h:212
Interface for a plugin-defined task executor.
Definition PluginInterface.h:345