2 #ifndef _MADARA_NO_KARL_ 41 for (ComponentNodes::iterator i =
nodes_.begin (); i !=
nodes_.end ();
44 bool arg_can_change =
false;
45 result = (*i)->prune (arg_can_change);
47 if (!arg_can_change && dynamic_cast <LeafNode *> (*i) == 0)
57 "madara::expression::SystemCallRandDouble: " 59 "System call rand_double" 60 " can have up to three arguments, 1) floor, " 61 "2) ceiling and 3) whether to set the random seed\n");
63 throw KarlException (
"madara::expression::SystemCallRandDouble: " 64 "KARL COMPILE ERROR: " 65 "System call rand_double" 66 " can have up to three arguments, 1) floor, " 67 "2) ceiling and 3) whether to set the random seeds\n");
79 double floor (0.0), ceiling (1.0);
80 bool update_srand =
true;
84 floor =
nodes_[0]->evaluate (settings).to_double ();
88 ceiling =
nodes_[1]->evaluate (settings).to_double ();
92 update_srand =
nodes_[2]->evaluate (settings).to_integer () != 0;
98 "madara::expression::SystemCallRandDouble: " 99 "System call rand_double called with %f, %f, %d\n",
100 floor, ceiling, update_srand);
111 visitor.
visit (*
this);
114 #endif // _MADARA_NO_KARL_ This class encapsulates an entry in a KnowledgeBase.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
SystemCallRandDouble(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
madara::knowledge::KnowledgeRecord KnowledgeRecord
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
logger::Logger * logger_
handle the context
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.
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
#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.
An exception for unrecoverable KaRL compilation issues.
Interface for a MADARA system call.
double rand_double(double floor, double ceiling, bool set_seed_to_time)
Returns a random double between floor and ceiling.
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.
virtual ~SystemCallRandDouble(void)
Destructor.
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.