MADARA  3.4.1
madara::expression::PreOrderIteratorImpl Class Reference

Iterates through an ExpressionTree in level-order. More...

#include <IteratorImpl.h>

Inheritance diagram for madara::expression::PreOrderIteratorImpl:
madara::expression::ExpressionTreeIteratorImpl

Public Types

typedef int difference_type
 
typedef ::std::forward_iterator_tag iterator_category
 
typedef int * pointer
 
typedef int & reference
 
typedef madara::knowledge::KnowledgeRecord value_type
 

Public Member Functions

 PreOrderIteratorImpl (const ExpressionTree &tree, bool end_iter=false)
 Construct an LevelOrderExpressionTreeIterator. More...
 
virtual ~PreOrderIteratorImpl ()
 Dtor. More...
 
virtual ExpressionTreeIteratorImplclone (void)
 Method for cloning an impl. Necessary for post increments. More...
 
virtual bool operator!= (const ExpressionTreeIteratorImpl &lhs) const
 Nonequality operator. More...
 
virtual ExpressionTree operator* (void)
 Dereference operator returns a reference to the item contained at the current position. More...
 
virtual const ExpressionTree operator* (void) const
 Returns a const reference to the item contained at the current position. More...
 
virtual void operator++ (void)
 Increment operator (used for both pre- and post-increment). More...
 
virtual bool operator== (const ExpressionTreeIteratorImpl &rhs) const
 Equality operator. More...
 

Protected Attributes

const ExpressionTreetree_
 The tree we are iterating over. More...
 

Private Attributes

madara::utility::LStack< ExpressionTreestack_
 Our current position in the iteration. More...
 

Friends

class ExpressionTreeIterator
 
class utility::Refcounter< ExpressionTreeIteratorImpl >
 

Detailed Description

Iterates through an ExpressionTree in level-order.

   Plays the role of the "implementor" class in the Bridge
   pattern that defines the level-order iteration algorithm.

Definition at line 144 of file IteratorImpl.h.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

Definition at line 179 of file IteratorImpl.h.

◆ pointer

Definition at line 181 of file IteratorImpl.h.

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ PreOrderIteratorImpl()

madara::expression::PreOrderIteratorImpl::PreOrderIteratorImpl ( const ExpressionTree tree,
bool  end_iter = false 
)

Construct an LevelOrderExpressionTreeIterator.

Construct an PreOrderExpressionTreeIterator.

If end_iter is set to true, the iterator points to the end of the tree. Otherwise, the iterator starts with a free tree.

If end_iter is set to true, the iterator points to the end of the tree

Definition at line 160 of file IteratorImpl.cpp.

◆ ~PreOrderIteratorImpl()

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

Dtor.

destructor - nothing to do

Definition at line 172 of file IteratorImpl.cpp.

Member Function Documentation

◆ clone()

madara::expression::ExpressionTreeIteratorImpl * madara::expression::PreOrderIteratorImpl::clone ( void  )
virtual

Method for cloning an impl. Necessary for post increments.

Method for cloning an impl.

Necessary for post increments (bridge)

See also
ExpressionTreeIterator

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 273 of file IteratorImpl.cpp.

◆ operator!=()

bool madara::expression::PreOrderIteratorImpl::operator!= ( const ExpressionTreeIteratorImpl lhs) const
virtual

Nonequality operator.

checks two iterators for inequality

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 263 of file IteratorImpl.cpp.

◆ operator*() [1/2]

madara::expression::ExpressionTree madara::expression::PreOrderIteratorImpl::operator* ( void  )
virtual

Dereference operator returns a reference to the item contained at the current position.

Returns the Node that the iterator is pointing to (non-const version)

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 176 of file IteratorImpl.cpp.

◆ operator*() [2/2]

const madara::expression::ExpressionTree madara::expression::PreOrderIteratorImpl::operator* ( void  ) const
virtual

Returns a const reference to the item contained at the current position.

Returns the Node that the iterator is pointing to (const version)

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 185 of file IteratorImpl.cpp.

◆ operator++()

void madara::expression::PreOrderIteratorImpl::operator++ ( void  )
virtual

Increment operator (used for both pre- and post-increment).

moves the iterator to the next node (pre-increment)

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 192 of file IteratorImpl.cpp.

◆ operator==()

bool madara::expression::PreOrderIteratorImpl::operator== ( const ExpressionTreeIteratorImpl rhs) const
virtual

Equality operator.

checks two iterators for equality

Implements madara::expression::ExpressionTreeIteratorImpl.

Definition at line 217 of file IteratorImpl.cpp.

Friends And Related Function Documentation

◆ ExpressionTreeIterator

friend class ExpressionTreeIterator
friend

Definition at line 146 of file IteratorImpl.h.

◆ utility::Refcounter< ExpressionTreeIteratorImpl >

Definition at line 146 of file IteratorImpl.h.

Member Data Documentation

◆ stack_

madara::utility::LStack<ExpressionTree> madara::expression::PreOrderIteratorImpl::stack_
private

Our current position in the iteration.

Definition at line 187 of file IteratorImpl.h.

◆ tree_

const ExpressionTree& madara::expression::ExpressionTreeIteratorImpl::tree_
protectedinherited

The tree we are iterating over.

Definition at line 81 of file IteratorImpl.h.


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