MADARA
3.1.8
|
Defines a terminal node of that references the current value stored in a variable. More...
#include <VariableCompareNode.h>
Public Types | |
enum | Comparators { LESS_THAN = 0, LESS_THAN_EQUAL = 1, EQUAL = 2, GREATER_THAN = 3, GREATER_THAN_EQUAL = 4 } |
Public Member Functions | |
VariableCompareNode (ComponentNode *lhs, madara::knowledge::KnowledgeRecord value, int type, ComponentNode *rhs, madara::knowledge::ThreadSafeContext &context) | |
Ctor. More... | |
virtual | ~VariableCompareNode (void) |
Dtor. More... | |
virtual void | accept (Visitor &visitor) const |
Define the accept() operation used for the Visitor pattern. More... | |
virtual madara::knowledge::KnowledgeRecord | evaluate (const madara::knowledge::KnowledgeUpdateSettings &settings) |
Evaluates the node and its children. More... | |
std::string | expand_key (void) const |
Expands the key (if necessary). More... | |
virtual madara::knowledge::KnowledgeRecord | item (void) const |
Return the item stored in the node. More... | |
const std::string & | key (void) const |
Return the variable key. More... | |
virtual ComponentNode * | left (void) const |
Returns the left expression. More... | |
virtual madara::knowledge::KnowledgeRecord | prune (bool &can_change) |
Prune the tree of unnecessary nodes. More... | |
virtual ComponentNode * | right (void) const |
Returns the right expression. More... | |
void | set_logger (logger::Logger &logger) |
Sets the logger for printing errors and debugging info. More... | |
Protected Attributes | |
logger::Logger * | logger_ |
handle the context More... | |
Private Attributes | |
CompositeArrayReference * | array_ |
variable index holder More... | |
int | compare_type_ |
comparison function More... | |
madara::knowledge::ThreadSafeContext & | context_ |
ComponentNode * | rhs_ |
holds a right hand side argument if it is not value_ More... | |
madara::knowledge::KnowledgeRecord | value_ |
amount to increment by. Note that this can also do decrement. More... | |
VariableNode * | var_ |
variable holder More... | |
Defines a terminal node of that references the current value stored in a variable.
Definition at line 29 of file VariableCompareNode.h.
Enumerator | |
---|---|
LESS_THAN | |
LESS_THAN_EQUAL | |
EQUAL | |
GREATER_THAN | |
GREATER_THAN_EQUAL |
Definition at line 38 of file VariableCompareNode.h.
madara::expression::VariableCompareNode::VariableCompareNode | ( | ComponentNode * | lhs, |
madara::knowledge::KnowledgeRecord | value, | ||
int | type, | ||
ComponentNode * | rhs, | ||
madara::knowledge::ThreadSafeContext & | context | ||
) |
Ctor.
Definition at line 13 of file VariableCompareNode.cpp.
|
virtual |
Dtor.
Definition at line 27 of file VariableCompareNode.cpp.
|
virtual |
Define the accept() operation used for the Visitor pattern.
Reimplemented from madara::expression::ComponentNode.
Definition at line 33 of file VariableCompareNode.cpp.
|
virtual |
Evaluates the node and its children.
This does not prune any of the expression tree, and is much faster than the prune function
Implements madara::expression::ComponentNode.
Definition at line 96 of file VariableCompareNode.cpp.
std::string madara::expression::VariableCompareNode::expand_key | ( | void | ) | const |
Expands the key (if necessary).
This allow for keys to be defined with other variables inserted (e.g. var{.id} with .id = 2 expands to var2)
|
virtual |
Return the item stored in the node.
Reimplemented from madara::expression::ComponentNode.
Definition at line 39 of file VariableCompareNode.cpp.
const std::string& madara::expression::VariableCompareNode::key | ( | void | ) | const |
Return the variable key.
|
virtualinherited |
Returns the left expression.
Reimplemented in madara::expression::CompositeBinaryNode.
Definition at line 34 of file ComponentNode.cpp.
|
virtual |
Prune the tree of unnecessary nodes.
Returns evaluation of the node and sets can_change appropriately. if this node can be changed, that means it shouldn't be pruned.
Implements madara::expression::ComponentNode.
Definition at line 55 of file VariableCompareNode.cpp.
|
virtualinherited |
Returns the right expression.
Reimplemented in madara::expression::CompositeUnaryNode.
Definition at line 41 of file ComponentNode.cpp.
|
inherited |
Sets the logger for printing errors and debugging info.
logger | the logger to use |
Definition at line 53 of file ComponentNode.cpp.
|
private |
variable index holder
Definition at line 79 of file VariableCompareNode.h.
|
private |
comparison function
Definition at line 90 of file VariableCompareNode.h.
|
private |
Definition at line 87 of file VariableCompareNode.h.
|
protectedinherited |
handle the context
Definition at line 96 of file ComponentNode.h.
|
private |
holds a right hand side argument if it is not value_
Definition at line 85 of file VariableCompareNode.h.
|
private |
amount to increment by. Note that this can also do decrement.
Definition at line 82 of file VariableCompareNode.h.
|
private |
variable holder
Definition at line 76 of file VariableCompareNode.h.