3 #ifndef COMPOSITE_OR_NODE_CPP 4 #define COMPOSITE_OR_NODE_CPP 6 #ifndef _MADARA_NO_KARL_ 36 for (ComponentNodes::iterator i =
nodes_.begin ();
37 i !=
nodes_.end (); ++i, ++j)
39 bool value_changes =
false;
41 value = (*i)->prune (value_changes);
42 if (!value_changes && dynamic_cast <LeafNode *> (*i) == 0)
52 value || return_value);
54 can_change = can_change || value_changes;
67 for (ComponentNodes::iterator i =
nodes_.begin ();
68 i !=
nodes_.end (); ++i, ++j)
71 if ((*i)->evaluate (settings).is_true ())
83 visitor.
visit (*
this);
86 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the printable character of the node.
madara::knowledge::KnowledgeRecord KnowledgeRecord
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node.
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.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
A multi-threaded logger for logging to one or more destinations.
CompositeOrNode(logger::Logger &logger, const ComponentNodes &nodes)
Constructor.
Abstract base class for all visitors to all classes that derive from ComponentNode.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
Copyright (c) 2015 Carnegie Mellon University.