feisty meow concerns codebase  2.140
nodes::path Class Reference

A method for tracing a route from a tree's root to a particular node. More...

#include <path.h>

Inheritance diagram for nodes::path:
Collaboration diagram for nodes::path:

Public Member Functions

 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...
 

Detailed Description

A method for tracing a route from a tree's root to a particular node.

A path has a starting point at a particular node and a list of links to take from that node to another node. For the path to remain valid, none of the links contained within it may be destroyed.

Definition at line 35 of file path.h.

Constructor & Destructor Documentation

◆ path() [1/2]

nodes::path::path ( const node root)

the path is relative to the "root" node.

this will be the first object pushed onto the stack that we use to model the path.

Definition at line 39 of file path.cpp.

◆ path() [2/2]

nodes::path::path ( const path to_copy)

Definition at line 43 of file path.cpp.

◆ ~path()

nodes::path::~path ( )

Definition at line 47 of file path.cpp.

References basis::WHACK().

Member Function Documentation

◆ current()

node * nodes::path::current ( ) const

Definition at line 59 of file path.cpp.

Referenced by generate_path().

◆ DEFINE_CLASS_NAME()

nodes::path::DEFINE_CLASS_NAME ( "path"  )

◆ follow()

node * nodes::path::follow ( ) const

Returns the node specified by this path.

if the path is not valid, NULL_POINTER is returned.

Definition at line 61 of file path.cpp.

◆ generate_path()

bool nodes::path::generate_path ( node to_locate,
path to_follow 
) const

finds the way to get from the root to the "to_locate" node.

returns true if there is a path between the relative root of this path and the node "to_locate". if there is such a path, "to_follow" is set to one of the possible paths.

Definition at line 87 of file path.cpp.

References current(), FUNCDEF, and LOG.

◆ operator=()

path & nodes::path::operator= ( const path to_copy)

Definition at line 63 of file path.cpp.

◆ operator[]()

node * nodes::path::operator[] ( int  index) const

returns the node stored at "index", or NULL_POINTER if "index" is invalid.

Definition at line 53 of file path.cpp.

◆ pop()

node * nodes::path::pop ( )

returns the top node on the path stack.

this returns the node at the farthest distance from the relative root node and removes it from this path.

Definition at line 70 of file path.cpp.

References NULL_POINTER.

◆ push() [1/2]

outcome nodes::path::push ( int  index)

indexed push uses the current top node's index'th link as new top.

adds the node at "index" of the current top node to the path, providing that such a link number exists on the current node.

Definition at line 81 of file path.cpp.

◆ push() [2/2]

outcome nodes::path::push ( node to_add)

puts the node "to_add" on the top of the stack.

adds a node to the path as long as "to_add" is one of the current node's descendants.

Definition at line 78 of file path.cpp.

◆ root()

node * nodes::path::root ( ) const

returns the relative root node for this path.

Definition at line 57 of file path.cpp.

◆ size()

int nodes::path::size ( ) const

returns the number of items in the path.

Definition at line 55 of file path.cpp.

Referenced by nodes::tree::generate_path(), and nodes::symbol_tree::text_form().


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