MADARA
3.1.8
|
Defines a terminal node of that references the current value stored in a variable. More...
#include <CompositeArrayReference.h>
Public Member Functions | |
CompositeArrayReference (const std::string &key, ComponentNode *index, madara::knowledge::ThreadSafeContext &context) | |
Constructor. More... | |
virtual | ~CompositeArrayReference (void) |
Dtor. More... | |
virtual void | accept (Visitor &visitor) const |
Define the accept() operation used for the Visitor pattern. More... | |
knowledge::KnowledgeRecord | dec (const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings()) |
Sets the value stored in the node. More... | |
virtual madara::knowledge::KnowledgeRecord | evaluate (const madara::knowledge::KnowledgeUpdateSettings &settings) |
Evaluates the node and its children. More... | |
std::string | expand_key (void) const |
Expands the key (if necessary). More... | |
madara::knowledge::KnowledgeRecord * | get_record (void) |
Retrieves the underlying knowledge::KnowledgeRecord in the context (useful for system calls). More... | |
knowledge::KnowledgeRecord | inc (const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings()) |
Sets the value stored in the node. More... | |
virtual madara::knowledge::KnowledgeRecord | item (void) const |
Return the item stored in the node. More... | |
const std::string & | key (void) const |
Return the variable key. More... | |
virtual ComponentNode * | left (void) const |
Returns the left expression. More... | |
virtual madara::knowledge::KnowledgeRecord | prune (bool &can_change) |
Prune the tree of unnecessary nodes. More... | |
virtual ComponentNode * | right (void) const |
Returns the right expression. More... | |
int | set (const madara::knowledge::KnowledgeRecord::Integer &value, const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings()) |
Sets the value stored in the node. More... | |
int | set (double value, const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings()) |
Sets the value stored in the node. More... | |
int | set (const madara::knowledge::KnowledgeRecord &value, const madara::knowledge::KnowledgeUpdateSettings &settings=knowledge::KnowledgeUpdateSettings()) |
Sets the value stored in the node. More... | |
void | set_logger (logger::Logger &logger) |
Sets the logger for printing errors and debugging info. More... | |
Protected Attributes | |
logger::Logger * | logger_ |
handle the context More... | |
ComponentNode * | right_ |
Right expression. More... | |
Private Attributes | |
madara::knowledge::ThreadSafeContext & | context_ |
const std::string | key_ |
Key for retrieving value of this variable. More... | |
bool | key_expansion_necessary_ |
Expansion necessary. More... | |
std::vector< std::string > | pivot_list_ |
madara::knowledge::KnowledgeRecord * | record_ |
std::vector< std::string > | splitters_ |
std::vector< std::string > | tokens_ |
Defines a terminal node of that references the current value stored in a variable.
Definition at line 28 of file CompositeArrayReference.h.
madara::expression::CompositeArrayReference::CompositeArrayReference | ( | const std::string & | key, |
ComponentNode * | index, | ||
madara::knowledge::ThreadSafeContext & | context | ||
) |
Constructor.
key | the variable name |
index | index within the array |
context | the context the variable is contained in |
Definition at line 12 of file CompositeArrayReference.cpp.
|
virtual |
Dtor.
Definition at line 88 of file CompositeArrayReference.cpp.
|
virtual |
Define the accept() operation used for the Visitor pattern.
Reimplemented from madara::expression::ComponentNode.
Definition at line 137 of file CompositeArrayReference.cpp.
madara::knowledge::KnowledgeRecord madara::expression::CompositeArrayReference::dec | ( | const madara::knowledge::KnowledgeUpdateSettings & | settings = knowledge::KnowledgeUpdateSettings () | ) |
Sets the value stored in the node.
Definition at line 198 of file CompositeArrayReference.cpp.
|
virtual |
Evaluates the node and its children.
This does not prune any of the expression tree, and is much faster than the prune function
Implements madara::expression::ComponentNode.
Definition at line 176 of file CompositeArrayReference.cpp.
std::string madara::expression::CompositeArrayReference::expand_key | ( | void | ) | const |
Expands the key (if necessary).
This allow for keys to be defined with other variables inserted (e.g. var{.id} with .id = 2 expands to var2)
Definition at line 94 of file CompositeArrayReference.cpp.
|
inline |
Retrieves the underlying knowledge::KnowledgeRecord in the context (useful for system calls).
Definition at line 99 of file CompositeArrayReference.h.
madara::knowledge::KnowledgeRecord madara::expression::CompositeArrayReference::inc | ( | const madara::knowledge::KnowledgeUpdateSettings & | settings = knowledge::KnowledgeUpdateSettings () | ) |
Sets the value stored in the node.
Definition at line 237 of file CompositeArrayReference.cpp.
|
virtual |
Return the item stored in the node.
Reimplemented from madara::expression::ComponentNode.
Definition at line 143 of file CompositeArrayReference.cpp.
const std::string & madara::expression::CompositeArrayReference::key | ( | void | ) | const |
Return the variable key.
Definition at line 190 of file CompositeArrayReference.cpp.
|
virtualinherited |
Returns the left expression.
Reimplemented in madara::expression::CompositeBinaryNode.
Definition at line 34 of file ComponentNode.cpp.
|
virtual |
Prune the tree of unnecessary nodes.
Returns evaluation of the node and sets can_change appropriately. if this node can be changed, that means it shouldn't be pruned.
Implements madara::expression::ComponentNode.
Definition at line 159 of file CompositeArrayReference.cpp.
|
virtualinherited |
Returns the right expression.
Reimplemented from madara::expression::ComponentNode.
Definition at line 24 of file CompositeUnaryNode.cpp.
int madara::expression::CompositeArrayReference::set | ( | const madara::knowledge::KnowledgeRecord::Integer & | value, |
const madara::knowledge::KnowledgeUpdateSettings & | settings = knowledge::KnowledgeUpdateSettings () |
||
) |
Sets the value stored in the node.
Definition at line 291 of file CompositeArrayReference.cpp.
int madara::expression::CompositeArrayReference::set | ( | double | value, |
const madara::knowledge::KnowledgeUpdateSettings & | settings = knowledge::KnowledgeUpdateSettings () |
||
) |
Sets the value stored in the node.
Definition at line 319 of file CompositeArrayReference.cpp.
int madara::expression::CompositeArrayReference::set | ( | const madara::knowledge::KnowledgeRecord & | value, |
const madara::knowledge::KnowledgeUpdateSettings & | settings = knowledge::KnowledgeUpdateSettings () |
||
) |
Sets the value stored in the node.
Definition at line 276 of file CompositeArrayReference.cpp.
|
inherited |
Sets the logger for printing errors and debugging info.
logger | the logger to use |
Definition at line 53 of file ComponentNode.cpp.
|
private |
Definition at line 112 of file CompositeArrayReference.h.
|
private |
Key for retrieving value of this variable.
Definition at line 109 of file CompositeArrayReference.h.
|
private |
Expansion necessary.
Definition at line 115 of file CompositeArrayReference.h.
|
protectedinherited |
handle the context
Definition at line 96 of file ComponentNode.h.
|
private |
Definition at line 119 of file CompositeArrayReference.h.
|
private |
Definition at line 110 of file CompositeArrayReference.h.
|
protectedinherited |
Right expression.
Definition at line 43 of file CompositeUnaryNode.h.
|
private |
Definition at line 117 of file CompositeArrayReference.h.
|
private |
Definition at line 118 of file CompositeArrayReference.h.