symbol_tree.h

Go to the documentation of this file.
00001 #ifndef SYMBOL_TREE_CLASS
00002 #define SYMBOL_TREE_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : symbol_tree                                                       *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1992-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "tree.h"
00019 
00020 #include <basis/object_base.h>
00021 
00022 namespace nodes {
00023 
00024 // forward.
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 } // namespace.
00106 
00107 #endif
00108 

Generated on Fri Nov 21 04:29:51 2008 for HOOPLE Libraries by  doxygen 1.5.1