nodes::packable_tree Class Reference

A tree object that can be packed into an array of bytes and unpacked again. More...

#include <packable_tree.h>

Inheritance diagram for nodes::packable_tree:
Inheritance graph
[legend]
Collaboration diagram for nodes::packable_tree:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 packable_tree ()
 constructs a new tree with a root and zero branches.
int recursive_packed_size () const
 spiders the tree starting at this node to calculate the packed size.
void recursive_pack (basis::byte_array &packed_form) const
 packs the whole tree starting at this node into the packed form.

Static Public Member Functions

static packable_treerecursive_unpack (basis::byte_array &packed_form, packable_tree_factory &creator)
 unpacks a tree stored in "packed_form" and returns it.

Detailed Description

A tree object that can be packed into an array of bytes and unpacked again.

Definition at line 29 of file packable_tree.h.


Constructor & Destructor Documentation

nodes::packable_tree::packable_tree (  ) 

constructs a new tree with a root and zero branches.

Definition at line 81 of file packable_tree.cpp.


Member Function Documentation

void nodes::packable_tree::recursive_pack ( basis::byte_array packed_form  )  const

packs the whole tree starting at this node into the packed form.

Definition at line 138 of file packable_tree.cpp.

References nodes::FINISH, NIL, nodes::tree::postfix, and nodes::tree::start().

Referenced by filesystem::directory_tree::pack().

int nodes::packable_tree::recursive_packed_size (  )  const

spiders the tree starting at this node to calculate the packed size.

Definition at line 127 of file packable_tree.cpp.

References NIL, nodes::tree::postfix, and nodes::tree::start().

Referenced by filesystem::directory_tree::packed_size().

packable_tree * nodes::packable_tree::recursive_unpack ( basis::byte_array packed_form,
packable_tree_factory creator 
) [static]

unpacks a tree stored in "packed_form" and returns it.

if NIL is returned, then the unpack failed. the "creator" is needed for making new derived packable_tree objects of the type stored.

Definition at line 152 of file packable_tree.cpp.

References structures::stack< contents >::acquire_pop(), nodes::tree::attach(), nodes::ATTACH_BRANCHES, nodes::BRANCHES_FOLLOW, nodes::packable_tree_factory::create(), nodes::FINISH, NIL, structures::stack< contents >::push(), structures::stack< contents >::size(), basis::packable::unpack(), and basis::WHACK().


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:25:43 2012 for hoople2 project by  doxygen 1.6.3