MADARA  3.2.3
SystemCallGetTimeSeconds.cpp
Go to the documentation of this file.
1 
2 #ifndef _MADARA_NO_KARL_
3 
4 #include <time.h>
10 
11 
14  const ComponentNodes & nodes)
15  : SystemCallNode (context, nodes)
16 {
17 
18 }
19 
20 // Dtor
22 {
23 }
24 
27 {
29 }
30 
36 {
37  // Time changes. No way to prune this node out.
38  can_change = true;
39 
41 
42  if (nodes_.size () > 0)
43  {
44  bool arg_can_change = false;
45  result = nodes_[0]->prune (arg_can_change);
46 
47  if (!arg_can_change && dynamic_cast <LeafNode *> (nodes_[0]) == 0)
48  {
49  delete nodes_[0];
50  nodes_[0] = new LeafNode (*(this->logger_), result);
51  }
52  }
53 
54  return result;
55 }
56 
62 {
64  "madara::expression::SystemCallGetTimeSeconds:"
65  "System call get_time_seconds is returning the system clock\n");
66 
68  time (NULL));
69 }
70 
71 // accept a visitor
72 void
74  madara::expression::Visitor &visitor) const
75 {
76  visitor.visit (*this);
77 }
78 
79 #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
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
logger::Logger * logger_
handle the context
Definition: ComponentNode.h:97
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
This class stores variables and their values for use by any entity needing state information in a thr...
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
Definition: LeafNode.h:23
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
SystemCallGetTimeSeconds(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.
Definition: Logger.h:32
Abstract base class for all visitors to all classes that derive from ComponentNode.
Definition: Visitor.h:91
Interface for a MADARA system call.
Settings for applying knowledge updates.
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.