2 #ifndef _MADARA_NO_KARL_ 17 array_ (0), value_ (value), rhs_ (rhs), context_ (context)
33 visitor.
visit (*
this);
55 bool left_child_can_change =
false;
56 bool right_child_can_change =
false;
60 left_child_can_change =
true;
64 "KARL COMPILE ERROR : Variable divide node has no variable");
71 right_value = this->
rhs_->
prune (right_child_can_change);
72 if (!right_child_can_change && dynamic_cast <LeafNode *> (
rhs_) == 0)
81 "KARL COMPILE ERROR : Variable divide node " 82 " has no right expression");
87 can_change = left_child_can_change || right_child_can_change;
108 "VariableDivideNode::evaluate: " 109 "Attempting to set variable %s to %s.\n",
120 "VariableDivideNode::evaluate: " 121 "Attempting to set index of var %s to %s.\n",
132 "VariableDivideNode::evaluate: " 133 "left hand side was neither a variable nor an array reference. " 134 "Check your expression for errors.\n",
143 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)=0
Prunes the expression tree of unnecessary nodes.
virtual ~VariableDivideNode(void)
Dtor.
Defines a terminal node of that references the current value stored in a variable.
int set(const madara::knowledge::KnowledgeRecord::Integer &value, const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings())
Sets the value stored in the node.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
ComponentNode * rhs_
holds a right hand side argument if it is not value_
logger::Logger * logger_
handle the context
This class stores variables and their values for use by any entity needing state information in a thr...
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)=0
Evaluates the expression tree.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
int set(const madara::knowledge::KnowledgeRecord::Integer &value, const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings())
Sets the value stored in the node.
VariableDivideNode(ComponentNode *lhs, madara::knowledge::KnowledgeRecord value, ComponentNode *rhs, madara::knowledge::ThreadSafeContext &context)
Ctor.
An abstract base class defines a simple abstract implementation of an expression tree node...
Abstract base class for all visitors to all classes that derive from ComponentNode.
CompositeArrayReference * array_
variable index holder
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
madara::knowledge::KnowledgeRecord value_
amount to increment by. Note that this can also do decrement.
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
Settings for applying knowledge updates.
VariableNode * var_
variable holder
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
std::string to_string(const std::string &delimiter=", ") const
converts the value to a string.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prune the tree of unnecessary nodes.
virtual void accept(Visitor &visitor) const
Define the accept() operation used for the Visitor pattern.
std::string expand_key(void) const
Expands the key (if necessary).
std::string expand_key(void) const
Expands the key (if necessary).
Defines a terminal node of that references the current value stored in a variable.