home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbdatabs / rbtreeb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-03-14  |  2.6 KB  |  65 lines

  1. // ------------------------------- //
  2. // -------- Start of File -------- //
  3. // ------------------------------- //
  4. // ----------------------------------------------------------- //
  5. // C++ Header File Name: rbtreeb.h
  6. // Compiler Used: MSVC40, DJGPP 2.7.2.1, GCC 2.7.2.1, HP CPP 10.24
  7. // Produced By: Doug Gaer   
  8. // File Creation Date: 01/23/1997 
  9. // Date Last Modified: 03/15/1999
  10. // Copyright (c) 1997 Douglas M. Gaer
  11. // ----------------------------------------------------------- // 
  12. // ---------- Include File Description and Details  ---------- // 
  13. // ----------------------------------------------------------- // 
  14. /*
  15. The VBD C++ classes are copyright (c) 1997, by Douglas M. Gaer.
  16. All those who put this code or its derivatives in a commercial
  17. product MUST mention this copyright in their documentation for
  18. users of the products in which this code or its derivative
  19. classes are used. Otherwise, you have the freedom to redistribute
  20. verbatim copies of this source code, adapt it to your specific
  21. needs, or improve the code and release your improvements to the
  22. public provided that the modified files carry prominent notices
  23. stating that you changed the files and the date of any change.
  24.  
  25. THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
  26. THE ENTIRE RISK OF THE QUALITY AND PERFORMANCE OF THIS SOFTWARE
  27. IS WITH YOU. SHOULD ANY ELEMENT OF THIS SOFTWARE PROVE DEFECTIVE,
  28. YOU WILL ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
  29. CORRECTION.
  30.  
  31. (R)ed (B)lack (T)ree node data independent functions. 
  32. */
  33. // ----------------------------------------------------------- //   
  34. #ifndef __RBTREEB_HPP
  35. #define __RBTREEB_HPP
  36.  
  37. #include "rbnode.h"
  38.  
  39. // The PtrPack struct is used to to save function-calling overhead
  40. struct PtrPack
  41. {
  42.   RBNodeBase *t;  // The current node
  43.   RBNodeBase *p;  // Parent 
  44.   RBNodeBase *g;  // Grandparent 
  45.   RBNodeBase *gg; // Great Grandparent
  46.   RBNodeBase *s;  // Sibling 
  47.   RBNodeBase *rs; // Right children of s
  48.   RBNodeBase *ls; // Left children of s
  49.   RBNodeBase *m;  // Matching node 
  50.   RBNodeBase *pm; // Parent of matching node
  51. };
  52.  
  53. // Standalone functions that operate on RBNodeBase pointers.
  54. // This implementation provides maximum code sharing.
  55. RBNodeBase *InsBalance(RBNodeBase *Root, PtrPack &pp);
  56. RBNodeBase *DelBalance(RBNodeBase *Root, PtrPack &pp);
  57. RBNodeBase *DoReplacement(RBNodeBase *Root, PtrPack &pp);
  58. RBNodeBase *DetachMinMax(RBNodeBase *&Root, int mx);
  59.  
  60. #endif // __RBTREEB_HPP
  61. // ----------------------------------------------------------- // 
  62. // ------------------------------- //
  63. // --------- End of File --------- //
  64. // ------------------------------- //
  65.