2 #ifndef _MADARA_NO_KARL_
37 if (nodes_.size() > 0)
39 bool arg_can_change =
false;
40 result = nodes_[0]->prune(arg_can_change);
42 if (!arg_can_change &&
dynamic_cast<LeafNode*
>(nodes_[0]) == 0)
45 nodes_[0] =
new LeafNode(*(this->logger_), result);
51 "madara::expression::SystemCallPrint: "
53 "System call size requires an argument\n");
56 "KARL COMPILE ERROR: "
57 "System call size requires an argument\n");
71 if (nodes_.size() == 1)
74 "madara::expression::SystemCallPrint: "
75 "System call print is printing the first argument and returning the"
76 " size of the first argument\n");
78 std::string statement(nodes_[0]->evaluate(settings).to_string());
84 else if (nodes_.size() == 2)
86 std::string statement(nodes_[0]->evaluate(settings).to_string());
87 unsigned int log_level =
88 (
unsigned int)nodes_[1]->evaluate(settings).to_integer();
91 "madara::expression::SystemCallPrint: "
92 "System call print is printing the first argument at log level %d.\n",
95 context_.print(statement, log_level);
102 "madara::expression::SystemCallPrint: "
103 "KARL RUNTIME ERROR:"
104 "System call size requires an argument\n");
107 "KARL RUNTIME ERROR: "
108 "System call size requires an argument\n");
118 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.
Interface for a MADARA system call.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
SystemCallPrint(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
virtual ~SystemCallPrint(void)
Destructor.
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