MADARA  3.2.3
madara::expression::VariableDivideNode Class Reference

Composite node that divides a variable by some right hand side. More...

#include <VariableDivideNode.h>

Inheritance diagram for madara::expression::VariableDivideNode:
madara::expression::ComponentNode

Public Member Functions

 VariableDivideNode (ComponentNode *lhs, madara::knowledge::KnowledgeRecord value, ComponentNode *rhs, madara::knowledge::ThreadSafeContext &context)
 Ctor. More...
 
virtual ~VariableDivideNode (void)
 Dtor. More...
 
virtual void accept (Visitor &visitor) const
 Define the accept() operation used for the Visitor pattern. 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...
 
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...
 
void set_logger (logger::Logger &logger)
 Sets the logger for printing errors and debugging info. More...
 

Protected Attributes

logger::Loggerlogger_
 handle the context More...
 

Private Attributes

CompositeArrayReferencearray_
 variable index holder More...
 
madara::knowledge::ThreadSafeContextcontext_
 
ComponentNoderhs_
 holds a right hand side argument if it is not value_ More...
 
madara::knowledge::KnowledgeRecord value_
 amount to increment by. Note that this can also do decrement. More...
 
VariableNodevar_
 variable holder More...
 

Detailed Description

Composite node that divides a variable by some right hand side.

Definition at line 28 of file VariableDivideNode.h.

Constructor & Destructor Documentation

madara::expression::VariableDivideNode::VariableDivideNode ( ComponentNode lhs,
madara::knowledge::KnowledgeRecord  value,
ComponentNode rhs,
madara::knowledge::ThreadSafeContext context 
)

Ctor.

Definition at line 12 of file VariableDivideNode.cpp.

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

Dtor.

Definition at line 25 of file VariableDivideNode.cpp.

Member Function Documentation

void madara::expression::VariableDivideNode::accept ( Visitor visitor) const
virtual

Define the accept() operation used for the Visitor pattern.

Reimplemented from madara::expression::ComponentNode.

Definition at line 31 of file VariableDivideNode.cpp.

madara::knowledge::KnowledgeRecord madara::expression::VariableDivideNode::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 100 of file VariableDivideNode.cpp.

std::string madara::expression::VariableDivideNode::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)

madara::knowledge::KnowledgeRecord madara::expression::VariableDivideNode::item ( void  ) const
virtual

Return the item stored in the node.

Reimplemented from madara::expression::ComponentNode.

Definition at line 37 of file VariableDivideNode.cpp.

const std::string& madara::expression::VariableDivideNode::key ( void  ) const

Return the variable key.

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::VariableDivideNode::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 53 of file VariableDivideNode.cpp.

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

Returns the right expression.

Returns
a pointer to the right expression

Reimplemented in madara::expression::CompositeUnaryNode.

Definition at line 41 of file ComponentNode.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

CompositeArrayReference* madara::expression::VariableDivideNode::array_
private

variable index holder

Definition at line 69 of file VariableDivideNode.h.

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

Definition at line 77 of file VariableDivideNode.h.

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

handle the context

Definition at line 97 of file ComponentNode.h.

ComponentNode* madara::expression::VariableDivideNode::rhs_
private

holds a right hand side argument if it is not value_

Definition at line 75 of file VariableDivideNode.h.

madara::knowledge::KnowledgeRecord madara::expression::VariableDivideNode::value_
private

amount to increment by. Note that this can also do decrement.

Definition at line 72 of file VariableDivideNode.h.

VariableNode* madara::expression::VariableDivideNode::var_
private

variable holder

Definition at line 66 of file VariableDivideNode.h.


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