2 #ifndef _MADARA_NO_KARL_
34 if (nodes_.size() == 1)
36 bool arg_can_change =
false;
38 cos(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;
51 "madara::expression::SystemCallCos: "
53 "System call cos requires 1 argument,"
54 " e.g., #cos (1.5), where 1.5 is radians\n");
57 "madara::expression::SystemCallCos: "
58 "KARL COMPILE ERROR: "
59 "System call cos requires 1 argument,"
60 " e.g., #cos (1.5), where 1.5 is radians\n");
73 if (nodes_.size() == 1)
76 "madara::expression::SystemCallCos: "
77 "System call cos is returning the cosine "
78 "of its first argument\n");
81 cos(nodes_[0]->evaluate(settings).to_double()));
86 "madara::expression::SystemCallCos: "
88 "System call cos requires 1 argument,"
89 " e.g., #cos (1.5), where 1.5 is radians\n");
92 "madara::expression::SystemCallCos: "
93 "KARL RUNTIME ERROR: "
94 "System call cos requires 1 argument,"
95 " e.g., #cos (1.5), where 1.5 is radians\n");
105 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.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
virtual ~SystemCallCos(void)
Destructor.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
SystemCallCos(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
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.
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