feisty meow concerns codebase  2.140
nodes::tree::iterator Class Reference

#include <tree.h>

Inheritance diagram for nodes::tree::iterator:
Collaboration diagram for nodes::tree::iterator:

Public Member Functions

 iterator (const tree *initial, traversal_directions direction)
 
 ~iterator ()
 
treenext ()
 Returns a pointer to the next tree in the direction of traversal. More...
 
void whack (tree *to_whack)
 destroys the tree "to_whack". More...
 
- Public Member Functions inherited from nodes::path
 path (const node *root)
 the path is relative to the "root" node. More...
 
 path (const path &to_copy)
 
 ~path ()
 
 DEFINE_CLASS_NAME ("path")
 
pathoperator= (const path &to_copy)
 
int size () const
 returns the number of items in the path. More...
 
noderoot () const
 returns the relative root node for this path. More...
 
nodecurrent () const
 
nodefollow () const
 Returns the node specified by this path. More...
 
nodepop ()
 returns the top node on the path stack. More...
 
basis::outcome push (node *to_add)
 puts the node "to_add" on the top of the stack. More...
 
basis::outcome push (int index)
 indexed push uses the current top node's index'th link as new top. More...
 
bool generate_path (node *to_locate, path &to_follow) const
 finds the way to get from the root to the "to_locate" node. More...
 
nodeoperator[] (int index) const
 returns the node stored at "index", or NULL_POINTER if "index" is invalid. More...
 
- Public Member Functions inherited from basis::nameable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Public Attributes

traversal_directions _order
 
elevator_directions _aim
 

Detailed Description

Definition at line 119 of file tree.h.

Constructor & Destructor Documentation

◆ iterator()

nodes::tree::iterator::iterator ( const tree initial,
traversal_directions  direction 
)

Definition at line 45 of file tree.cpp.

◆ ~iterator()

nodes::tree::iterator::~iterator ( )

Definition at line 50 of file tree.cpp.

Member Function Documentation

◆ next()

tree * nodes::tree::iterator::next ( )

Returns a pointer to the next tree in the direction of traversal.

If the traversal is finished, NULL_POINTER is returned.

Definition at line 257 of file tree.cpp.

References FUNCDEF, and NULL_POINTER.

Referenced by nodes::symbol_tree::text_form().

◆ whack()

void nodes::tree::iterator::whack ( tree to_whack)

destroys the tree "to_whack".

whacks the node "to_whack" by patching this iterator so that future iterations will be correct. it is required that the "to_whack" node was just returned from a call to next(). NOTE: this has only been tested with postfix so far.

Definition at line 221 of file tree.cpp.

References FUNCDEF, LOG, nodes::tree::parent(), nodes::tree::prune(), and basis::WHACK().

Member Data Documentation

◆ _aim

elevator_directions nodes::tree::iterator::_aim

Definition at line 137 of file tree.h.

◆ _order

traversal_directions nodes::tree::iterator::_order

Definition at line 136 of file tree.h.


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