MADARA
3.1.8
Main Page
Namespaces
Classes
Files
File List
File Members
SystemCallSetScientific.cpp
Go to the documentation of this file.
1
2
#ifndef _MADARA_NO_KARL_
3
4
5
#include "
madara/expression/LeafNode.h
"
6
#include "
madara/expression/SystemCallSetScientific.h
"
7
#include "
madara/knowledge/ThreadSafeContext.h
"
8
#include "
madara/expression/Visitor.h
"
9
10
11
madara::expression::SystemCallSetScientific::SystemCallSetScientific
(
12
madara::knowledge::ThreadSafeContext
& context,
13
const
ComponentNodes
& nodes)
14
:
SystemCallNode
(context, nodes)
15
{
16
17
}
18
19
// Dtor
20
madara::expression::SystemCallSetScientific::~SystemCallSetScientific
(
void
)
21
{
22
}
23
24
madara::knowledge::KnowledgeRecord
25
madara::expression::SystemCallSetScientific::item
(
void
)
const
26
{
27
return
madara::knowledge::KnowledgeRecord
(
nodes_
.size ());
28
}
29
33
madara::knowledge::KnowledgeRecord
34
madara::expression::SystemCallSetScientific::prune
(
bool
& can_change)
35
{
36
// user can always change a function, and we have no control over
37
// what it does. Consequently, a function node cannot be pruned out
38
// under any situation
39
can_change =
true
;
40
41
madara::knowledge::KnowledgeRecord
result;
42
43
if
(
nodes_
.size () > 0)
44
{
45
bool
arg_can_change =
false
;
46
result =
nodes_
[0]->prune (arg_can_change);
47
48
if
(!arg_can_change && dynamic_cast <LeafNode *> (
nodes_
[0]) == 0)
49
{
50
delete
nodes_
[0];
51
nodes_
[0] =
new
LeafNode
(*(this->
logger_
), result);
52
}
53
}
54
55
return
result;
56
}
57
60
madara::knowledge::KnowledgeRecord
61
madara::expression::SystemCallSetScientific::evaluate
(
62
const
madara::knowledge::KnowledgeUpdateSettings
&
/*settings*/
)
63
{
64
knowledge::KnowledgeRecord
return_value;
65
66
madara_logger_ptr_log
(
logger_
,
logger::LOG_MINOR
,
67
"System call set_fixed is setting double output format to "
68
"std::scientific.\n"
);
69
70
knowledge::KnowledgeRecord::set_scientific
();
71
72
return
return_value;
73
}
74
75
// accept a visitor
76
void
77
madara::expression::SystemCallSetScientific::accept
(
78
madara::expression::Visitor
&visitor)
const
79
{
80
visitor.
visit
(*
this
);
81
}
82
83
#endif // _MADARA_NO_KARL_
madara::knowledge::KnowledgeRecord
This class encapsulates an entry in a KnowledgeBase.
Definition:
KnowledgeRecord.h:60
SystemCallSetScientific.h
madara::expression::SystemCallSetScientific::prune
virtual madara::knowledge::KnowledgeRecord prune(bool &can_change)
Prunes the expression tree of unnecessary nodes.
Definition:
SystemCallSetScientific.cpp:34
KnowledgeRecord
madara::knowledge::KnowledgeRecord KnowledgeRecord
Definition:
VariableCompareNode.cpp:8
madara::expression::CompositeTernaryNode::nodes_
ComponentNodes nodes_
Definition:
CompositeTernaryNode.h:76
madara::expression::ComponentNodes
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
Definition:
ComponentNode.h:100
madara::expression::SystemCallSetScientific::accept
virtual void accept(Visitor &visitor) const
Accepts a visitor subclassed from the Visitor class.
Definition:
SystemCallSetScientific.cpp:77
madara::expression::ComponentNode::logger_
logger::Logger * logger_
handle the context
Definition:
ComponentNode.h:96
ThreadSafeContext.h
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::LeafNode
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
Definition:
LeafNode.h:23
madara_logger_ptr_log
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
Definition:
Logger.h:32
madara::expression::Visitor
Abstract base class for all visitors to all classes that derive from ComponentNode.
Definition:
Visitor.h:90
LeafNode.h
madara::expression::SystemCallSetScientific::~SystemCallSetScientific
virtual ~SystemCallSetScientific(void)
Destructor.
Definition:
SystemCallSetScientific.cpp:20
madara::expression::SystemCallSetScientific::item
virtual madara::knowledge::KnowledgeRecord item(void) const
Returns the value of the node.
Definition:
SystemCallSetScientific.cpp:25
madara::expression::SystemCallSetScientific::evaluate
virtual madara::knowledge::KnowledgeRecord evaluate(const madara::knowledge::KnowledgeUpdateSettings &settings)
Evaluates the expression tree.
Definition:
SystemCallSetScientific.cpp:61
madara::expression::SystemCallNode
Interface for a MADARA system call.
Definition:
SystemCallNode.h:25
madara::knowledge::KnowledgeRecord::set_scientific
static void set_scientific(void)
Sets the output format for doubles to std::scientific.
Definition:
KnowledgeRecord.cpp:50
madara::expression::SystemCallSetScientific::SystemCallSetScientific
SystemCallSetScientific(madara::knowledge::ThreadSafeContext &context, const ComponentNodes &nodes)
Constructor.
Definition:
SystemCallSetScientific.cpp:11
madara::logger::LOG_MINOR
Definition:
Logger.h:77
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.
include
madara
expression
SystemCallSetScientific.cpp
Generated on Wed May 9 2018 18:17:14 for MADARA by
1.8.11