dlistval.h 2.2 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_DLISTVAL_H
  21. #define _AAPL_DLISTVAL_H
  22. /**
  23. * \addtogroup dlist
  24. * @{
  25. */
  26. /**
  27. * \class DListVal
  28. * \brief By-value doubly linked list.
  29. *
  30. * This class is a doubly linked list that does not require a list element
  31. * type to be declared. The user instead gives a type that is to be stored in
  32. * the list element. When inserting a new data item, the value is copied into
  33. * a newly allocated element. This list is inteded to behave and be utilized
  34. * like the list template found in the STL.
  35. *
  36. * DListVal is different from the other lists in that it allocates elements
  37. * itself. The raw element insert interface is still exposed for convenience,
  38. * however, the list assumes all elements in the list are allocated on the
  39. * heap and are to be managed by the list. The destructor WILL delete the
  40. * contents of the list. If the list is ever copied in from another list, the
  41. * existing contents are deleted first. This is in contrast to DList and
  42. * DListMel, which will never delete their contents to allow for statically
  43. * allocated elements.
  44. *
  45. * \include ex_dlistval.cpp
  46. */
  47. /*@}*/
  48. #define BASE_EL(name) name
  49. #define DLMEL_TEMPDEF class T
  50. #define DLMEL_TEMPUSE T
  51. #define DList DListVal
  52. #define Element DListValEl<T>
  53. #define DOUBLELIST_VALUE
  54. #include "dlcommon.h"
  55. #undef BASE_EL
  56. #undef DLMEL_TEMPDEF
  57. #undef DLMEL_TEMPUSE
  58. #undef DList
  59. #undef Element
  60. #undef DOUBLELIST_VALUE
  61. #endif /* _AAPL_DLISTVAL_H */