1 #ifndef MADARA_SYSTEM_CALL_GENERIC_H_
2 #define MADARA_SYSTEM_CALL_GENERIC_H_
4 #ifndef _MADARA_NO_KARL_
30 std::vector<madara::knowledge::KnowledgeRecord>);
32 using fn_type = std::function<fn_signature>;
72 std::vector<madara::knowledge::KnowledgeRecord> args;
73 args.reserve(
nodes_.size());
74 for (
const auto& node :
nodes_)
76 args.emplace_back(node->evaluate(settings));
78 return fn_(std::move(args));
madara::knowledge::KnowledgeRecord KnowledgeRecord
General purpose system call KaRL node.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
madara::knowledge::KnowledgeRecord(std::vector< madara::knowledge::KnowledgeRecord >) fn_signature
const char * name() const
std::function< fn_signature > fn_type
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
SystemCallGeneric(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes, const char *name, fn_type fn)
Constructor.
Interface for a MADARA system call.
Abstract base class for all visitors to all classes that derive from ComponentNode.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
This class encapsulates an entry in a KnowledgeBase.
Settings for applying knowledge updates.
This class stores variables and their values for use by any entity needing state information in a thr...
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
Copyright(c) 2020 Galois.