2 #ifndef _MADARA_NO_KARL_ 17 array_ (0), value_ (value), rhs_ (rhs), context_ (context)
34 visitor.
visit (*
this);
56 bool left_child_can_change =
false;
57 bool right_child_can_change =
false;
61 left_child_can_change =
true;
65 "KARL COMPILE ERROR : Variable Multiply Node has no variable");
72 right_value = this->
rhs_->
prune (right_child_can_change);
73 if (!right_child_can_change && dynamic_cast <LeafNode *> (
rhs_) == 0)
82 "KARL COMPILE ERROR : Variable multiply assignment " 83 "has no right expression");
88 can_change = left_child_can_change || right_child_can_change;
109 "VariableMultiplyNode::evaluate: " 110 "Attempting to set variable %s to %s.\n",
121 "VariableMultiplyNode::evaluate: " 122 "Attempting to set index of var %s to %s.\n",
133 "VariableMultiplyNode::evaluate: " 134 "left hand side was neither a variable nor an array reference. " 135 "Check your expression for errors.\n",
146 #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.
madara::knowledge::KnowledgeRecord value_
amount to increment by. Note that this can also do decrement.
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.
virtual void accept(Visitor &visitor) const
Define the accept() operation used for the Visitor pattern.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prune the tree of unnecessary nodes.
logger::Logger * logger_
handle the context
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
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.
VariableNode * var_
variable holder
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
ComponentNode * rhs_
holds a right hand side argument if it is not value_
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.
CompositeArrayReference * array_
variable index holder
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.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
virtual ~VariableMultiplyNode(void)
Dtor.
VariableMultiplyNode(ComponentNode *lhs, madara::knowledge::KnowledgeRecord value, ComponentNode *rhs, madara::knowledge::ThreadSafeContext &context)
Ctor.
Settings for applying knowledge updates.
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.
std::string expand_key(void) const
Expands the key (if necessary).
std::string expand_key(void) const
Expands the key (if necessary).
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
Defines a terminal node of that references the current value stored in a variable.