MADARA  3.4.1
VariableCompareNode.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef _MADARA_VARIABLE_COMPARE_NODE_H_
3 #define _MADARA_VARIABLE_COMPARE_NODE_H_
4 
5 #ifndef _MADARA_NO_KARL_
6 
7 #include <string>
8 #include <vector>
9 
15 
16 namespace madara
17 {
18 namespace expression
19 {
20 // Forward declarations.
21 class Visitor;
22 
30 {
31 public:
36 
38  {
39  LESS_THAN = 0,
41  EQUAL = 2,
44  };
45 
47  virtual ~VariableCompareNode(void);
48 
50  virtual madara::knowledge::KnowledgeRecord item(void) const;
51 
55  virtual madara::knowledge::KnowledgeRecord prune(bool& can_change);
56 
61 
65  std::string expand_key(void) const;
66 
68  const std::string& key(void) const;
69 
71  virtual void accept(Visitor& visitor) const;
72 
73 private:
76 
79 
82 
85 
87 
90 
92 };
93 }
94 }
95 
96 #endif // _MADARA_NO_KARL_
97 
98 #endif /* _MADARA_VARIABLE_COMPARE_NODE_H_ */
An abstract base class defines a simple abstract implementation of an expression tree node.
Definition: ComponentNode.h:37
Defines a terminal node of that references the current value stored in a variable.
Defines a terminal node of that references the current value stored in a variable.
CompositeArrayReference * array_
variable index holder
ComponentNode * rhs_
holds a right hand side argument if it is not value_
VariableNode * var_
variable holder
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.
const std::string & key(void) const
Return the variable key.
VariableCompareNode(ComponentNode *lhs, madara::knowledge::KnowledgeRecord value, int type, ComponentNode *rhs, madara::knowledge::ThreadSafeContext &context)
Ctor.
madara::knowledge::ThreadSafeContext & context_
std::string expand_key(void) const
Expands the key (if necessary).
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prune the 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.
Definition: VariableNode.h:29
Abstract base class for all visitors to all classes that derive from ComponentNode.
Definition: Visitor.h:93
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...
constexpr string_t string
Copyright(c) 2020 Galois.