2 #ifndef _MADARA_NO_KARL_
37 for (ComponentNodes::iterator i = nodes_.begin(); i != nodes_.end(); ++i)
39 bool arg_can_change =
false;
40 result = (*i)->prune(arg_can_change);
42 if (!arg_can_change &&
dynamic_cast<LeafNode*
>(*i) == 0)
45 *i =
new LeafNode(*(this->logger_), result);
60 if (nodes_.size() > 0)
64 if (nodes_.size() > 1)
67 delimiter = nodes_[1]->evaluate(settings).to_string(delimiter);
69 if (nodes_.size() > 2)
72 "madara::expression::SystemCallToString: "
74 "System call to_string"
75 " may have up to 2 arguments. First is a value to change to string."
76 " An optional second is a delimiter for array stringification\n");
79 "madara::expression::SystemCallToString: "
80 "KARL RUNTIME ERROR: "
81 "System call to_string"
82 " may have up to 2 arguments. First is a value to change to string."
83 " An optional second is a delimiter for array stringification\n");
88 "madara::expression::SystemCallToString: "
89 "System call to_string is converting an argument\n");
92 nodes_[0]->evaluate(settings).to_string(delimiter));
97 "madara::expression::SystemCallToString: "
99 "System call to_string requires an argument\n");
102 "madara::expression::SystemCallToString: "
103 "KARL RUNTIME ERROR: "
104 "System call to_string requires an argument\n");
116 visitor.
visit(*
this);
#define madara_logger_ptr_log(loggering, level,...)
Fast version of the madara::logger::log method for Logger pointers.
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 ~SystemCallToString(void)
Destructor.
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 madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
SystemCallToString(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
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.
void set_value(const KnowledgeRecord &new_value)
Sets the value from another KnowledgeRecord, does not copy toi, clock, and write_quality.
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