MADARA  3.1.8
madara::expression::CompositeArrayReference Class Reference

Defines a terminal node of that references the current value stored in a variable. More...

#include <CompositeArrayReference.h>

Inheritance diagram for madara::expression::CompositeArrayReference:
Collaboration diagram for madara::expression::CompositeArrayReference:

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::KnowledgeRecordget_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 ComponentNodeleft (void) const
 Returns the left expression. More...
 
virtual madara::knowledge::KnowledgeRecord prune (bool &can_change)
 Prune the tree of unnecessary nodes. More...
 
virtual ComponentNoderight (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::Loggerlogger_
 handle the context More...
 
ComponentNoderight_
 Right expression. More...
 

Private Attributes

madara::knowledge::ThreadSafeContextcontext_
 
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::KnowledgeRecordrecord_
 
std::vector< std::string > splitters_
 
std::vector< std::string > tokens_
 

Detailed Description

Defines a terminal node of that references the current value stored in a variable.

Definition at line 28 of file CompositeArrayReference.h.

Constructor & Destructor Documentation

madara::expression::CompositeArrayReference::CompositeArrayReference ( const std::string &  key,
ComponentNode index,
madara::knowledge::ThreadSafeContext context 
)

Constructor.

Parameters
keythe variable name
indexindex within the array
contextthe context the variable is contained in

Definition at line 12 of file CompositeArrayReference.cpp.

madara::expression::CompositeArrayReference::~CompositeArrayReference ( void  )
virtual

Dtor.

Definition at line 88 of file CompositeArrayReference.cpp.

Member Function Documentation

void madara::expression::CompositeArrayReference::accept ( Visitor visitor) const
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.

madara::knowledge::KnowledgeRecord madara::expression::CompositeArrayReference::evaluate ( const madara::knowledge::KnowledgeUpdateSettings settings)
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.

madara::knowledge::KnowledgeRecord* madara::expression::CompositeArrayReference::get_record ( void  )
inline

Retrieves the underlying knowledge::KnowledgeRecord in the context (useful for system calls).

Returns
the knowledge::KnowledgeRecord inside of the context

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.

madara::knowledge::KnowledgeRecord madara::expression::CompositeArrayReference::item ( void  ) const
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.

madara::expression::ComponentNode * madara::expression::ComponentNode::left ( void  ) const
virtualinherited

Returns the left expression.

Returns
a pointer to the left expression

Reimplemented in madara::expression::CompositeBinaryNode.

Definition at line 34 of file ComponentNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::CompositeArrayReference::prune ( bool &  can_change)
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.

madara::expression::ComponentNode * madara::expression::CompositeUnaryNode::right ( void  ) const
virtualinherited

Returns the right expression.

Returns
a pointer to 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.

void madara::expression::ComponentNode::set_logger ( logger::Logger logger)
inherited

Sets the logger for printing errors and debugging info.

Parameters
loggerthe logger to use

Definition at line 53 of file ComponentNode.cpp.

Member Data Documentation

madara::knowledge::ThreadSafeContext& madara::expression::CompositeArrayReference::context_
private

Definition at line 112 of file CompositeArrayReference.h.

const std::string madara::expression::CompositeArrayReference::key_
private

Key for retrieving value of this variable.

Definition at line 109 of file CompositeArrayReference.h.

bool madara::expression::CompositeArrayReference::key_expansion_necessary_
private

Expansion necessary.

Definition at line 115 of file CompositeArrayReference.h.

logger::Logger* madara::expression::ComponentNode::logger_
protectedinherited

handle the context

Definition at line 96 of file ComponentNode.h.

std::vector< std::string> madara::expression::CompositeArrayReference::pivot_list_
private

Definition at line 119 of file CompositeArrayReference.h.

madara::knowledge::KnowledgeRecord* madara::expression::CompositeArrayReference::record_
private

Definition at line 110 of file CompositeArrayReference.h.

ComponentNode* madara::expression::CompositeUnaryNode::right_
protectedinherited

Right expression.

Definition at line 43 of file CompositeUnaryNode.h.

std::vector< std::string> madara::expression::CompositeArrayReference::splitters_
private

Definition at line 117 of file CompositeArrayReference.h.

std::vector< std::string> madara::expression::CompositeArrayReference::tokens_
private

Definition at line 118 of file CompositeArrayReference.h.


The documentation for this class was generated from the following files: