Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. dnode.inl
  6. Abstract:
  7. Node template class.
  8. Author:
  9. Weihai Chen (WeihaiC) 06/29/98
  10. Revision History:
  11. --*/
  12. template <class T, class KEYTYPE>
  13. TDoubleNode<T, KEYTYPE>::TDoubleNode(void):
  14. m_Data(NULL),
  15. m_pPrev(NULL),
  16. m_Next(NULL)
  17. {
  18. }
  19. template <class T, class KEYTYPE>
  20. TDoubleNode<T, KEYTYPE>::TDoubleNode(T item):
  21. m_Data(item),
  22. m_pPrev(NULL),
  23. m_pNext(NULL)
  24. {
  25. }
  26. template <class T, class KEYTYPE>
  27. TDoubleNode<T, KEYTYPE>::TDoubleNode(T item, TDoubleNode<T, KEYTYPE>* pPrev, TDoubleNode<T, KEYTYPE>* pNext):
  28. m_Data(item),
  29. m_pPrev(pPrev),
  30. m_pNext(pNext)
  31. {
  32. }
  33. template <class T, class KEYTYPE>
  34. TDoubleNode<T, KEYTYPE>::~TDoubleNode(void)
  35. {
  36. if (m_Data) {
  37. delete (m_Data);
  38. }
  39. }
  40. template <class T, class KEYTYPE>
  41. void
  42. TDoubleNode<T, KEYTYPE>::SetNext (TDoubleNode<T, KEYTYPE> *pNode)
  43. {
  44. m_pNext = pNode;
  45. }
  46. template <class T, class KEYTYPE>
  47. TDoubleNode<T, KEYTYPE> *
  48. TDoubleNode<T, KEYTYPE>::GetNext (void )
  49. {
  50. return m_pNext;
  51. }
  52. template <class T, class KEYTYPE>
  53. void
  54. TDoubleNode<T, KEYTYPE>::SetPrev (
  55. TDoubleNode<T, KEYTYPE> *pNode)
  56. {
  57. m_pPrev = pNode;
  58. }
  59. template <class T, class KEYTYPE>
  60. TDoubleNode<T, KEYTYPE> * TDoubleNode<T, KEYTYPE>::GetPrev (void )
  61. {
  62. return m_pPrev;
  63. }
  64. template <class T, class KEYTYPE>
  65. T TDoubleNode<T, KEYTYPE>::GetData (void )
  66. {
  67. return m_Data;
  68. }
  69. template <class T, class KEYTYPE>
  70. void TDoubleNode<T, KEYTYPE>::SetData (T pData)
  71. {
  72. m_Data = pData;
  73. }
  74. template <class T, class KEYTYPE>
  75. BOOL TDoubleNode<T, KEYTYPE>::IsSameItem (T &item)
  76. {
  77. return m_Data->Compare (item) == 0;
  78. }
  79. template <class T, class KEYTYPE>
  80. BOOL TDoubleNode<T, KEYTYPE>::IsSameKey (KEYTYPE &key)
  81. {
  82. return m_Data->Compare (key) == 0;
  83. }