2#include "Dataflow/Core/NodeFactory.hpp"
4#include <Dataflow/Core/Node.hpp>
19template <
class R,
class... Args>
50 RA_NODE_PORT_IN( function_type, from );
51 RA_NODE_PORT_OUT( function_type, to );
60template <
class R,
class... Args>
61FunctionSourceNode<R, Args...>::FunctionSourceNode(
const std::string& instanceName,
63 Node( instanceName, typeName ) {
64 m_port_in_from->set_default_value( []( Args... ) { return R {}; } );
65 m_port_out_to->set_data( &m_port_in_from->data() );
68template <
class R,
class... Args>
73template <
class R,
class... Args>
75 m_port_in_from->set_default_value(
std::move( data ) );
76 m_port_out_to->
set_data( &m_port_in_from->data() );
79template <
class R,
class... Args>
82 return m_port_in_from->
data();
85template <
class R,
class... Args>
88 std::string {
"Source<" } + Ra::Core::Utils::simplifiedDemangledType<function_type>() +
">";
89 return demangledTypeName;
Base abstract class for all the nodes added and used by the node system.
virtual bool fromJsonInternal(const nlohmann::json &data)
Internal json representation of the Node.
virtual void toJsonInternal(nlohmann::json &data) const
Internal json representation of the Node.
Node that deliver a std::function<R( Args... )}}>
void set_data(function_type data)
Set the function to be delivered by the node.
function_type * data() const
Get the delivered data.
bool execute() override
Executes the node.
bool fromJsonInternal(const nlohmann::json &data) override
Internal json representation of the Node.
void toJsonInternal(nlohmann::json &data) const override
Internal json representation of the Node.
hepler function to manage enum as underlying types in VariableSet