3 #ifndef COMPOSITE_AND_NODE_CPP 4 #define COMPOSITE_AND_NODE_CPP 6 #ifndef _MADARA_NO_KARL_ 40 for (ComponentNodes::iterator i =
nodes_.begin ();
41 i !=
nodes_.end (); ++i, ++j)
43 bool value_changes =
false;
45 value = (*i)->prune (value_changes);
46 if (!value_changes && dynamic_cast <LeafNode *> (*i) == 0)
56 value && return_value);
58 can_change = can_change || value_changes;
71 for (ComponentNodes::iterator i =
nodes_.begin ();
72 i !=
nodes_.end (); ++i, ++j)
75 if ((*i)->evaluate (settings).is_false ())
88 visitor.
visit (*
this);
91 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
madara::knowledge::KnowledgeRecord KnowledgeRecord
CompositeAndNode(logger::Logger &logger, const ComponentNodes &nodes)
Constructor.
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.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the printable character of the node.
A multi-threaded logger for logging to one or more destinations.
Abstract base class for all visitors to all classes that derive from ComponentNode.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
Copyright (c) 2015 Carnegie Mellon University.
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.