2 #ifndef _MADARA_NO_KARL_ 42 for (ComponentNodes::iterator i =
nodes_.begin (); i !=
nodes_.end ();
45 bool arg_can_change =
false;
46 result = (*i)->prune (arg_can_change);
48 if (!arg_can_change && dynamic_cast <LeafNode *> (*i) == 0)
58 "KARL ERROR: System call write_file requires 2 arguments: " 59 "a knowledge record and a file name\n");
84 "System call write_file is attempting to open %s.\n",
89 if (bytes_written <= 0)
92 "KARL ERROR: System call write_file could not write to %s\n",
100 "System call write_file wrote %zd bytes to %s\n",
101 bytes_written, filename->
to_string ().c_str ());
107 "KARL ERROR: System call write_file requires 2 arguments: " 108 "a knowledge record and a file name\n");
119 visitor.
visit (*
this);
122 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
madara::knowledge::KnowledgeRecord KnowledgeRecord
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
logger::Logger * logger_
handle the context
ssize_t to_file(const std::string &filename) const
writes the value to a file
This class stores variables and their values for use by any entity needing state information in a thr...
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
virtual ~SystemCallWriteFile(void)
Destructor.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
SystemCallWriteFile(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
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.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
Interface for a MADARA system call.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
std::string to_string(const std::string &delimiter=", ") const
converts the value to a string.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.