avlset.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2002 Adrian Thurston <thurston@cs.queensu.ca>
  3. */
  4. /* This file is part of Aapl.
  5. *
  6. * Aapl is free software; you can redistribute it and/or modify it under the
  7. * terms of the GNU Lesser General Public License as published by the Free
  8. * Software Foundation; either version 2.1 of the License, or (at your option)
  9. * any later version.
  10. *
  11. * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY
  12. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with Aapl; if not, write to the Free Software Foundation, Inc., 59
  18. * Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _AAPL_AVLSET_H
  21. #define _AAPL_AVLSET_H
  22. #include "compare.h"
  23. /**
  24. * \addtogroup avltree
  25. * @{
  26. */
  27. /**
  28. * \class AvlSet
  29. * \brief Key-only oriented tree.
  30. *
  31. * AvlSet stores only keys in elements that are managed by the tree. AvlSet
  32. * requires that a Key type and a class containing a compare() routine
  33. * for Key be given. Items are inserted with just a key value.
  34. *
  35. * AvlSet assumes all elements in the tree are allocated on the heap and are
  36. * to be managed by the tree. This means that the class destructor will delete
  37. * the contents of the tree. A deep copy will cause existing elements to be
  38. * deleted first.
  39. *
  40. * \include ex_avlset.cpp
  41. */
  42. /*@}*/
  43. #define AVLTREE_SET
  44. #define BASE_EL(name) name
  45. #define BASEKEY(name) name
  46. #define AVLMEL_CLASSDEF class Key, class Compare = CmpOrd<Key>
  47. #define AVLMEL_TEMPDEF class Key, class Compare
  48. #define AVLMEL_TEMPUSE Key, Compare
  49. #define AvlTree AvlSet
  50. #define Element AvlSetEl<Key>
  51. #include "avlcommon.h"
  52. #undef AVLTREE_SET
  53. #undef BASE_EL
  54. #undef BASEKEY
  55. #undef AVLMEL_CLASSDEF
  56. #undef AVLMEL_TEMPDEF
  57. #undef AVLMEL_TEMPUSE
  58. #undef AvlTree
  59. #undef Element
  60. #endif /* _AAPL_AVLSET_H */