HTBTree.h
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:2k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /*                                                                       Balanced Binary Tree
  2.                                    BALANCED BINARY TREE
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    Tree creation, traversal and freeing. User-supplied comparison routine.
  11.    
  12.    This module is implemented by HTBTree.c, and it is a part of the  W3C Reference
  13.    Library.
  14.    
  15.  */
  16. #ifndef HTBTTEE_H
  17. #define HTBTREE_H
  18. #include "HTArray.h"
  19. /*
  20.  */
  21. typedef struct _HTBTree HTBTree;
  22. typedef struct _HTBTree_element HTBTElement;
  23. /*
  24. Create a Binary Tree
  25.    This function creates a new binary tree and uses the comparison function when building
  26.    the tree.
  27.    
  28.  */
  29. extern HTBTree * HTBTree_new (HTComparer * comp);
  30. /*
  31. Free storage of the tree but not of the objects
  32.  */
  33. extern void HTBTree_free (HTBTree * tree);
  34. /*
  35. Free storage of the tree and of the objects
  36.  */
  37. extern void HTBTreeAndObject_free (HTBTree * tree);
  38. /*
  39. Add an object to a binary tree
  40.  */
  41. extern void HTBTree_add (HTBTree* tree, void * object);
  42. /*
  43. Return an Object
  44.  */
  45. extern void * HTBTree_object (HTBTElement * element);
  46. /*
  47. Find next element in depth-first order
  48.   ON ENTRY,
  49.   
  50.    If element is NULL then start with leftmost element. if not NULL then give next object
  51.    to the right. The function returns a pointer to element or NULL if none left.
  52.    
  53.  */
  54. extern HTBTElement * HTBTree_next (HTBTree * tree, HTBTElement * element);
  55. /*
  56.  */
  57. #endif
  58. /*
  59.    End of declaration of BTree */