OwnerTable.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: OwnerTable.h /main/2 1996/08/13 10:09:13 mgreess $ */
  24. // Copyright (c) 1994 James Clark
  25. // See the file COPYING for copying permission.
  26. #ifndef OwnerTable_INCLUDED
  27. #define OwnerTable_INCLUDED 1
  28. #include "PointerTable.h"
  29. #ifdef SP_NAMESPACE
  30. namespace SP_NAMESPACE {
  31. #endif
  32. template<class T, class K, class HF, class KF>
  33. class OwnerTable : public PointerTable<T *, K, HF, KF> {
  34. public:
  35. OwnerTable() { }
  36. ~OwnerTable();
  37. void clear();
  38. void swap(OwnerTable<T, K, HF, KF> &x) {
  39. PointerTable<T *, K, HF, KF>::swap(x);
  40. }
  41. private:
  42. OwnerTable(const OwnerTable<T, K, HF, KF> &) {}
  43. void operator=(const OwnerTable<T, K, HF, KF> &) {}
  44. };
  45. template<class T, class K, class HF, class KF>
  46. class OwnerTableIter : public PointerTableIter<T *, K, HF, KF> {
  47. public:
  48. OwnerTableIter(const OwnerTable<T, K, HF, KF> &table)
  49. : PointerTableIter<T *, K, HF, KF>(table) { }
  50. };
  51. template<class T, class K, class HF, class KF>
  52. class CopyOwnerTable : public OwnerTable<T, K, HF, KF> {
  53. public:
  54. CopyOwnerTable() { }
  55. CopyOwnerTable(const CopyOwnerTable<T, K, HF, KF> &tab) { *this = tab; }
  56. void operator=(const CopyOwnerTable<T, K, HF, KF> &tab);
  57. };
  58. #ifdef SP_NAMESPACE
  59. }
  60. #endif
  61. #endif /* not OwnerTable_INCLUDED */
  62. #ifdef SP_DEFINE_TEMPLATES
  63. #include "OwnerTable.C"
  64. #endif