00001 #ifndef SYMBOL_TREE_CLASS
00002 #define SYMBOL_TREE_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "tree.h"
00019
00020 #include <basis/object_base.h>
00021
00022 namespace nodes {
00023
00024
00025 class symbol_tree_associations;
00026
00028
00035 class NODES_CLASS_STYLE symbol_tree : public tree
00036 {
00037 public:
00038 symbol_tree(const istring &node_name, int max_bits = 2);
00040
00044 virtual ~symbol_tree();
00046
00050 IMPLEMENT_CLASS_NAME("symbol_tree");
00051
00052 int children() const;
00053
00054 const istring &name() const;
00055
00056 int max_bits() const;
00057
00058 symbol_tree *branch(int index) const;
00059
00060 void rehash(int max_bits);
00062
00063 void hash_appropriately(int max_per_bucket);
00065
00070 bool add(symbol_tree *to_add);
00072
00073 virtual outcome prune(tree *to_zap);
00075
00079 enum find_methods { just_branches, recurse_downward, recurse_upward };
00080
00081 symbol_tree *find(const istring &to_find,
00082 find_methods how = just_branches,
00083 string_comparator_function *comp = NIL);
00085
00094 void sort();
00096
00097 istring text_form() const;
00099
00100 private:
00101 symbol_tree_associations *_associations;
00102 istring *_name;
00103 };
00104
00105 }
00106
00107 #endif
00108