2 #ifndef _MADARA_NO_KARL_
34 if (nodes_.size() == 1)
36 bool arg_can_change =
false;
38 tan(nodes_[0]->prune(arg_can_change).to_double()));
40 if (!arg_can_change &&
dynamic_cast<LeafNode*
>(nodes_[0]) == 0)
43 nodes_[0] =
new LeafNode(*(this->logger_), result);
46 can_change = can_change || arg_can_change;
50 std::stringstream args;
52 for (
unsigned int i = 0; i < nodes_.size(); ++i)
57 args << nodes_[i]->prune(unused).to_double();
59 if (i != nodes_.size() - 1)
65 "madara::expression::SystemCallTan: "
66 "KARL COMPILE ERROR: System call tan encountered a null arg at "
73 "madara::expression::SystemCallTan: "
75 "System call tan requires 1 argument,"
76 " e.g., #tan (1.5), where 1.5 is radians. Args currently are: %s\n",
80 "madara::expression::SystemCallTan: "
81 "KARL COMPILE ERROR: "
82 "System call tan requires 1 argument,"
83 " e.g., #tan (1.5), where 1.5 is radians. Args currently are: " +
97 if (nodes_.size() == 1)
100 "madara::expression::SystemCallTan: "
101 "System call tan is returning the tangent "
102 "of its first argument\n");
105 tan(nodes_[0]->evaluate(settings).to_double()));
110 "madara::expression::SystemCallTan: "
111 "KARL RUNTIME ERROR:"
112 "System call tan requires 1 argument,"
113 " e.g., #tan (1.5), where 1.5 is radians\n");
116 "madara::expression::SystemCallTan: "
117 "KARL RUNTIME ERROR: "
118 "System call tan requires 1 argument,"
119 " e.g., #tan (1.5), where 1.5 is radians\n");
129 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 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 ~SystemCallTan(void)
Destructor.
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.
SystemCallTan(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
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