2 #ifndef _MADARA_NO_KARL_
39 if (nodes_.size() == 1)
41 bool arg_can_change =
false;
42 result = nodes_[0]->prune(arg_can_change);
44 if (!arg_can_change &&
dynamic_cast<LeafNode*
>(nodes_[0]) == 0)
47 nodes_[0] =
new LeafNode(*(this->logger_), result);
53 "madara::expression::SystemCallExpandStatement: "
55 "System call expand_var requires 1 argument,"
56 "e.g., #expand_statement ('var{.i}')\n");
59 "madara::expression::SystemCallExpandStatement: "
60 "KARL COMPILE ERROR: "
61 "System call expand_var requires 1 argument,"
62 "e.g., #expand_statement ('var{.i}')\n");
76 if (nodes_.size() == 1)
78 std::string statement(nodes_[0]->evaluate(settings).to_string());
81 "madara::expression::SystemCallExpandStatement: "
82 "System call expand_statement is returning the expansion "
91 "madara::expression::SystemCallExpandStatement: "
93 "System call expand_var requires 1 argument,"
94 "e.g., #expand_statement ('var{.i}')\n");
97 "madara::expression::SystemCallExpandStatement: "
98 "KARL RUNTIME ERROR: "
99 "System call expand_var requires 1 argument,"
100 "e.g., #expand_statement ('var{.i}')\n");
110 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.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value.
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.
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 ~SystemCallExpandStatement(void)
Destructor.
SystemCallExpandStatement(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
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