avliset.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_AVLISET_H
  21. #define _AAPL_AVLISET_H
  22. #include "compare.h"
  23. #include "dlist.h"
  24. /**
  25. * \addtogroup avlitree
  26. * @{
  27. */
  28. /**
  29. * \class AvliSet
  30. * \brief Linked Key-only oriented tree.
  31. *
  32. * AvliSet stores only keys in elements that are managed by the tree. AvliSet
  33. * requires that a Key type and a class containing a compare() routine
  34. * for Key be given. Items are inserted with just a key value.
  35. *
  36. * AvliSet assumes all elements in the tree are allocated on the heap and are
  37. * to be managed by the tree. This means that the class destructor will delete
  38. * the contents of the tree. A deep copy will cause existing elements to be
  39. * deleted first.
  40. *
  41. * \include ex_avliset.cpp
  42. */
  43. /*@}*/
  44. #define AVLTREE_SET
  45. #define BASE_EL(name) name
  46. #define BASEKEY(name) name
  47. #define BASELIST DList< AvliSetEl<Key> >
  48. #define AVLMEL_CLASSDEF class Key, class Compare = CmpOrd<Key>
  49. #define AVLMEL_TEMPDEF class Key, class Compare
  50. #define AVLMEL_TEMPUSE Key, Compare
  51. #define AvlTree AvliSet
  52. #define Element AvliSetEl<Key>
  53. #define WALKABLE
  54. #include "avlcommon.h"
  55. #undef AVLTREE_SET
  56. #undef BASE_EL
  57. #undef BASEKEY
  58. #undef BASELIST
  59. #undef AVLMEL_CLASSDEF
  60. #undef AVLMEL_TEMPDEF
  61. #undef AVLMEL_TEMPUSE
  62. #undef AvlTree
  63. #undef Element
  64. #undef WALKABLE
  65. #endif /* _AAPL_AVLISET_H */