2 #ifndef _MADARA_NO_KARL_
38 if (nodes_.size() > 0)
40 bool arg_can_change =
false;
41 result = nodes_[0]->prune(arg_can_change);
43 if (!arg_can_change &&
dynamic_cast<LeafNode*
>(nodes_[0]) == 0)
46 nodes_[0] =
new LeafNode(*(this->logger_), result);
52 "madara::expression::SystemCallEval: "
54 "System call eval requires an argument\n");
57 "KARL COMPILE ERROR: "
58 "System call eval requires an argument\n");
71 if (nodes_.size() > 0)
74 "madara::expression::SystemCallEval: "
75 "System call type is returning the eval of its first argument\n");
78 context_.compile(nodes_[0]->evaluate(settings).to_string());
85 "madara::expression::SystemCallEval: "
87 "System call eval requires an argument\n");
90 "KARL RUNTIME ERROR: "
91 "System call eval requires an argument\n");
101 visitor.
visit(*
this);
#define madara_logger_ptr_log(loggering, level,...)
Fast version of the madara::logger::log method for Logger pointers.
const ThreadSafeContext * context_
madara::knowledge::KnowledgeRecord KnowledgeRecord
An exception for unrecoverable KaRL compilation issues.
madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings())
Evaluates the expression tree.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value.
virtual ~SystemCallEval(void)
Destructor.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
SystemCallEval(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
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.
Compiled, optimized KaRL logic.
madara::expression::ExpressionTree expression
the expression tree
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