#include <packable_tree.h>
Inheritance diagram for nodes::packable_tree:


Public Member Functions | |
| packable_tree () | |
| constructs a new tree with a root and zero branches. | |
| virtual | ~packable_tree () |
| destroys the tree by recursively destroying all branch trees. | |
| void | recursive_pack (byte_array &packed_form) const |
| packs the whole tree starting at this node into the packed form. | |
| virtual void | pack (byte_array &packed_form) const=0 |
| turns this node into a compact flat form for storage. | |
| virtual bool | unpack (byte_array &packed_form)=0 |
| decompresses the "packed_form" for this node. | |
Static Public Member Functions | |
| static packable_tree * | recursive_unpack (byte_array &packed_form, packable_tree_factory &creator) |
| unpacks a tree stored in "packed_form" and returns it. | |
Definition at line 29 of file packable_tree.h.
| nodes::packable_tree::packable_tree | ( | ) |
constructs a new tree with a root and zero branches.
Definition at line 76 of file packable_tree.cpp.
| nodes::packable_tree::~packable_tree | ( | ) | [virtual] |
destroys the tree by recursively destroying all branch trees.
Definition at line 80 of file packable_tree.cpp.
| void nodes::packable_tree::recursive_pack | ( | byte_array & | packed_form | ) | const |
packs the whole tree starting at this node into the packed form.
for (tree::iterator zip = start(postfix); curr = iterate(zip); ) packit(curr, SIZE_ESTIMATION, current_place_to_stuff, accumulated_size);
accumulated_size += sizeof(tree_command_unit); packed_form.reset(accumulated_size); int size = accumulated_size;
current_place_to_stuff = (byte *)packed_form;
Definition at line 112 of file packable_tree.cpp.
References nodes::FINISH, NIL, nodes::tree::postfix, and nodes::tree::start().
Referenced by directory_tree::pack().
| packable_tree * nodes::packable_tree::recursive_unpack | ( | 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 138 of file packable_tree.cpp.
References stack< contents >::acquire_pop(), nodes::tree::attach(), nodes::ATTACH_BRANCHES, nodes::BRANCHES_FOLLOW, nodes::packable_tree_factory::create(), nodes::FINISH, common::IS_EMPTY, NIL, stack< contents >::push(), stack< contents >::size(), unpack(), and WHACK().
| virtual void nodes::packable_tree::pack | ( | byte_array & | packed_form | ) | const [pure virtual] |
turns this node into a compact flat form for storage.
Implements packable.
Implemented in filename_tree.
| virtual bool nodes::packable_tree::unpack | ( | byte_array & | packed_form | ) | [pure virtual] |
decompresses the "packed_form" for this node.
Implements packable.
Implemented in filename_tree.
Referenced by recursive_unpack().
1.5.1