23 using namespace basis;
27 #define LOG(to_print) printf("%s::%s: %s\n", static_class_name(), func, astring(to_print).s())
31 class path_node_stack :
public stack<node *>
40 : _stack(new path_node_stack)
41 { _stack->push(
const_cast<node *
>(start)); }
44 : _stack(new path_node_stack(*to_copy._stack))
49 while (_stack->elements()) _stack->pop();
65 if (
this == &to_copy)
return *
this;
66 *_stack = *to_copy._stack;
73 if (_stack->acquire_pop(to_return) != common::OKAY)
79 {
return _stack->push(to_add); }
83 if (!_stack->top()->get_link(index))
return common::NOT_FOUND;
84 return _stack->push(_stack->top()->get_link(index));
91 if (to_locate || to_follow.
current()) {}
92 LOG(
"hmmm: path::generate_path is not implemented.");
Outcomes describe the state of completion for an operation.
An object representing the interstitial cell in most linked data structures.
A method for tracing a route from a tree's root to a particular node.
bool generate_path(node *to_locate, path &to_follow) const
finds the way to get from the root to the "to_locate" node.
path & operator=(const path &to_copy)
node * root() const
returns the relative root node for this path.
int size() const
returns the number of items in the path.
node * follow() const
Returns the node specified by this path.
path(const node *root)
the path is relative to the "root" node.
basis::outcome push(node *to_add)
puts the node "to_add" on the top of the stack.
node * operator[](int index) const
returns the node stored at "index", or NULL_POINTER if "index" is invalid.
node * pop()
returns the top node on the path stack.
An abstraction that represents a stack data structure.
#define NULL_POINTER
The value representing a pointer to nothing.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
A dynamic container class that holds any kind of object via pointers.