Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. bintree.h
  5. Abstract:
  6. Routines that manage the binary trees in the memdb database
  7. Author:
  8. Matthew Vanderzee (mvander) 13-Aug-1999
  9. --*/
  10. //
  11. // all string arguments for BinTree functions must
  12. // be Pascal-style strings (use StringPas...() functions
  13. // defined in pastring.c).
  14. //
  15. //
  16. // returns offset of binary tree
  17. // OffsetOfString is the offset in bytes in the data structure
  18. // of the string used to order the different nodes
  19. //
  20. UINT BinTreeNew();
  21. //
  22. // returns INVALID_OFFSET if node already exists,
  23. // or offset of NODESTRUCT if add went okay
  24. //
  25. BOOL BinTreeAddNode(UINT TreeOffset, UINT data);
  26. //
  27. // removes node and returns offset of data
  28. //
  29. UINT BinTreeDeleteNode(UINT TreeOffset, PCWSTR str, PBOOL LastNode);
  30. //
  31. // returns pointer to data
  32. //
  33. UINT BinTreeFindNode(UINT TreeOffset, PCWSTR str);
  34. //
  35. // destroys and deallocates tree (but not data contained inside)
  36. //
  37. void BinTreeDestroy(UINT TreeOffset);
  38. //
  39. // enumerate first node in tree. this takes the offset of
  40. // the BINTREE struct and a pointer to a UINT which will
  41. // hold data for BinTreeEnumNext.
  42. //
  43. UINT BinTreeEnumFirst(UINT TreeOffset, PUINT pEnum);
  44. //
  45. // pEnum is the enumerator filled by BinTreeEnumFirst
  46. //
  47. UINT BinTreeEnumNext(PUINT pEnum);
  48. //
  49. // turns the binary tree to insertion order - can only be
  50. // done if the binary tree contains 0 or 1 nodes. return
  51. // TRUE if conversion is successful, or if binary tree is
  52. // already in Insertion-Ordered mode.
  53. //
  54. BOOL BinTreeSetInsertionOrdered(UINT TreeOffset);
  55. //
  56. // number of nodes in tree
  57. //
  58. UINT BinTreeSize(UINT TreeOffset);
  59. #ifdef DEBUG
  60. //
  61. // maximum depth of tree
  62. //
  63. int BinTreeMaxDepth(UINT TreeOffset);
  64. //
  65. // displays tree. strsize is length of strings to display
  66. //
  67. void BinTreePrint(UINT TreeOffset);
  68. //
  69. // checks to make sure tree is valid and good
  70. //
  71. BOOL BinTreeCheck(UINT TreeOffset);
  72. #else
  73. #define BinTreePrint(a)
  74. #define BinTreeCheck(a)
  75. #endif