2#include <Dataflow/Core/Node.hpp>
28template <
typename coll_t,
typename v_t =
typename coll_t::value_type>
67 RA_NODE_PORT_IN( coll_t, data );
69 RA_NODE_PORT_OUT_WITH_DATA( coll_t, result );
78template <
typename coll_t,
typename v_t>
80 FilterNode( instanceName, node_typename(), []( v_t ) {
return true; } ) {}
82template <
typename coll_t,
typename v_t>
84 FilterNode( instanceName, node_typename(), predicate ) {}
86template <
typename coll_t,
typename v_t>
88 m_port_in_predicate->set_default_value( predicate );
91template <
typename coll_t,
typename v_t>
97template <
typename coll_t,
typename v_t>
99 const auto& f = m_port_in_predicate->data();
100 const auto& inData = m_port_in_data->data();
108template <
typename coll_t,
typename v_t>
111 std::string {
"Filter<" } + Ra::Core::Utils::simplifiedDemangledType<coll_t>() +
">";
112 return demangledName;
115template <
typename coll_t,
typename v_t>
118 UnaryPredicate predicate ) :
119 Node( instanceName, typeName ) {
120 m_port_in_predicate->set_default_value( predicate );
T back_inserter(T... args)
Filter on iterable collection.
bool fromJsonInternal(const nlohmann::json &data) override
Internal json representation of the Node.
bool execute() override
Executes the node.
FilterNode(const std::string &instanceName)
Construct a filter accepting all its input ( true() lambda )
void toJsonInternal(nlohmann::json &data) const override
Internal json representation of the Node.
void set_predicate(UnaryPredicate predicate)
Sets the filtering predicate on the node.
void init() override
Initializes the node content.
std::function< bool(const v_t &)> UnaryPredicate
Base abstract class for all the nodes added and used by the node system.
virtual void init()
Initializes the node content.
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.
hepler function to manage enum as underlying types in VariableSet