3 #ifndef _COMPOSITE_RETURN_RIGHT_NODE_CPP_ 4 #define _COMPOSITE_RETURN_RIGHT_NODE_CPP_ 6 #ifndef _MADARA_NO_KARL_ 37 for (ComponentNodes::iterator i =
nodes_.begin ();
38 i !=
nodes_.end (); ++i, ++j)
40 bool value_changes =
false;
42 if (j + 1 ==
nodes_.size ())
43 return_value = (*i)->prune (value_changes);
45 (*i)->prune (value_changes);
47 if (!value_changes && dynamic_cast <LeafNode *> (*i) == 0)
53 can_change = can_change || value_changes;
69 for (ComponentNodes::iterator i =
nodes_.begin ();
70 i !=
nodes_.end (); ++i, ++j)
72 if (j + 1 == (
int)
nodes_.size ())
73 return_value = (*i)->evaluate (settings);
75 (*i)->evaluate (settings);
85 visitor.
visit (*
this);
88 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
madara::knowledge::KnowledgeRecord KnowledgeRecord
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
logger::Logger * logger_
handle the context
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
Provides knowledge logging services to files and terminals.
A multi-threaded logger for logging to one or more destinations.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the printable character of the node.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node.
Abstract base class for all visitors to all classes that derive from ComponentNode.
CompositeReturnRightNode(logger::Logger &logger, const ComponentNodes &nodes)
Constructor.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
Copyright (c) 2015 Carnegie Mellon University.