MADARA
3.1.8
Main Page
Namespaces
Classes
Files
File List
File Members
ListNode.cpp
Go to the documentation of this file.
1
2
#ifndef _MADARA_NO_KARL_
3
4
#include "
madara/expression/Visitor.h
"
5
#include "
madara/expression/ListNode.h
"
6
#include "
madara/utility/Utility.h
"
7
8
9
#include <string>
10
#include <sstream>
11
12
madara::expression::ListNode::ListNode
(
13
madara::knowledge::ThreadSafeContext
& context)
14
:
ComponentNode
(context.get_logger ()), context_ (context), list_ ()
15
{
16
17
}
18
19
madara::expression::ListNode::~ListNode
()
20
{
21
// do not clean up record_. Let the context clean that up.
22
}
23
24
25
void
26
madara::expression::ListNode::accept
(
Visitor
&visitor)
const
27
{
28
visitor.
visit
(*
this
);
29
}
30
31
madara::knowledge::KnowledgeRecord
32
madara::expression::ListNode::item
()
const
33
{
34
return
madara::knowledge::KnowledgeRecord
(
35
madara::knowledge::KnowledgeRecord::Integer
(
list_
.size ()));
36
}
37
41
madara::knowledge::KnowledgeRecord
42
madara::expression::ListNode::prune
(
bool
& can_change)
43
{
44
// a variable is one of very few nodes that can change over time and
45
// cannot be pruned
46
can_change =
true
;
47
48
return
madara::knowledge::KnowledgeRecord
(
49
madara::knowledge::KnowledgeRecord::Integer
(
list_
.size ()));
50
}
51
54
madara::knowledge::KnowledgeRecord
55
madara::expression::ListNode::evaluate
(
56
const
madara::knowledge::KnowledgeUpdateSettings
&
/*settings*/
)
57
{
58
return
madara::knowledge::KnowledgeRecord
(
59
madara::knowledge::KnowledgeRecord::Integer
(
list_
.size ()));
60
}
61
62
63
#endif // _MADARA_NO_KARL_
madara::knowledge::KnowledgeRecord
This class encapsulates an entry in a KnowledgeBase.
Definition:
KnowledgeRecord.h:60
madara::expression::ListNode::prune
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prune the tree of unnecessary nodes.
Definition:
ListNode.cpp:42
KnowledgeRecord
madara::knowledge::KnowledgeRecord KnowledgeRecord
Definition:
VariableCompareNode.cpp:8
ListNode.h
madara::expression::ListNode::list_
::std::list< ComponentNode * > list_
list of trees in a parameter list
Definition:
ListNode.h:57
madara::expression::ListNode::accept
virtual void accept(Visitor &visitor) const
Define the accept() operation used for the Visitor pattern.
Definition:
ListNode.cpp:26
madara::knowledge::KnowledgeRecord::Integer
int64_t Integer
Definition:
KnowledgeRecord.h:103
madara::expression::ListNode::item
virtual madara::knowledge::KnowledgeRecord item(void) const
Return the item stored in the node.
Definition:
ListNode.cpp:32
madara::knowledge::ThreadSafeContext
This class stores variables and their values for use by any entity needing state information in a thr...
Definition:
ThreadSafeContext.h:82
madara::expression::ListNode::ListNode
ListNode(madara::knowledge::ThreadSafeContext &context)
Ctor.
Definition:
ListNode.cpp:12
madara::expression::ListNode::evaluate
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the node and its children.
Definition:
ListNode.cpp:55
madara::expression::ComponentNode
An abstract base class defines a simple abstract implementation of an expression tree node...
Definition:
ComponentNode.h:35
madara::expression::Visitor
Abstract base class for all visitors to all classes that derive from ComponentNode.
Definition:
Visitor.h:90
Visitor.h
madara::knowledge::KnowledgeUpdateSettings
Settings for applying knowledge updates.
Definition:
KnowledgeUpdateSettings.h:23
madara::expression::Visitor::visit
virtual void visit(const LeafNode &node)=0
Visit a LeafNode.
Utility.h
madara::expression::ListNode::~ListNode
virtual ~ListNode(void)
Dtor.
Definition:
ListNode.cpp:19
include
madara
expression
ListNode.cpp
Generated on Wed May 9 2018 18:17:14 for MADARA by
1.8.11