MADARA  3.4.1
ComponentNode.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef _MADARA_COMPONENT_NODE_H_
3 #define _MADARA_COMPONENT_NODE_H_
4 
5 #ifndef _MADARA_NO_KARL_
6 
7 #include <string>
8 #include <deque>
9 #include <stdexcept>
12 #include "madara/utility/StdInt.h"
13 #include "madara/logger/Logger.h"
15 
16 namespace madara
17 {
18 namespace knowledge
19 {
20 class ThreadSafeContext;
21 }
22 
23 namespace expression
24 {
25 // Forward declaration.
26 class Visitor;
27 
37 {
38 public:
44 
48  virtual ~ComponentNode(void) = 0;
49 
54  virtual madara::knowledge::KnowledgeRecord item(void) const;
55 
60  virtual madara::knowledge::KnowledgeRecord prune(bool& can_change) = 0;
61 
68  const madara::knowledge::KnowledgeUpdateSettings& settings) = 0;
69 
74  virtual ComponentNode* left(void) const;
75 
80  virtual ComponentNode* right(void) const;
81 
86  virtual void accept(Visitor& visitor) const;
87 
93 
94 protected:
97 };
98 
100 typedef std::deque<ComponentNode*> ComponentNodes;
101 }
102 }
103 
104 #endif // _MADARA_NO_KARL_
105 
106 #endif /* _MADARA_COMPONENT_NODE_H_ */
An abstract base class defines a simple abstract implementation of an expression tree node.
Definition: ComponentNode.h:37
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)=0
Prunes the expression tree of unnecessary nodes.
ComponentNode(logger::Logger &logger)
Constructor.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
logger::Logger * logger_
handle the context
Definition: ComponentNode.h:96
virtual ComponentNode * right(void) const
Returns the right expression.
void set_logger(logger::Logger &logger)
Sets the logger for printing errors and debugging info.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)=0
Evaluates the expression tree.
virtual ComponentNode * left(void) const
Returns the left expression.
virtual ~ComponentNode(void)=0
Destructor.
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.
A multi-threaded logger for logging to one or more destinations.
Definition: Logger.h:165
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
Provides functions and classes for the distributed knowledge base.
Provides knowledge logging services to files and terminals.
Definition: GlobalLogger.h:12
Copyright(c) 2020 Galois.