Leaked source code of windows server 2003
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.

71 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. dlist.inl
  6. Abstract:
  7. Double linked list template class.
  8. Author:
  9. Weihai Chen (WeihaiC) 04/15/98
  10. Revision History:
  11. Weihai Chen (WeihaiC) 03/08/00 Rename to T*
  12. --*/
  13. #ifndef _DLIST_H
  14. #define _DLIST_H
  15. #include "dnode.hxx"
  16. template <class T, class KEYTYPE> class TDoubleList
  17. {
  18. public:
  19. TDoubleList( void );
  20. virtual ~TDoubleList( void );
  21. BOOL InsertItem ( T);
  22. BOOL AppendItem ( T);
  23. BOOL DeleteItem ( T);
  24. BOOL InsertNode (TDoubleNode <T, KEYTYPE> *);
  25. BOOL AppendNode (TDoubleNode <T, KEYTYPE> *);
  26. BOOL DeleteNode (TDoubleNode <T, KEYTYPE> *);
  27. TDoubleNode<T, KEYTYPE>* GetHead (void);
  28. virtual T GetItemFromIndex (DWORD dwIndex);
  29. TDoubleNode<T, KEYTYPE> * GetNodeFromIndex (DWORD dwIndex);
  30. BOOL GetTotalNode (PDWORD pdwCount);
  31. BOOL bValid() {return m_bValid;}
  32. protected:
  33. TDoubleNode <T, KEYTYPE> *m_pHead;
  34. TDoubleNode <T, KEYTYPE> *m_pTail;
  35. DWORD m_dwNumNode;
  36. BOOL m_bValid;
  37. };
  38. template <class T, class KEYTYPE> class TSrchDoubleList:
  39. public TDoubleList<T, KEYTYPE>
  40. {
  41. public:
  42. TSrchDoubleList( void ) {};
  43. virtual ~TSrchDoubleList( void ) {};
  44. virtual T FindItemFromItem (T );
  45. virtual T FindItemFromKey (KEYTYPE );
  46. TDoubleNode<T, KEYTYPE> * FindNodeFromItem (T item);
  47. TDoubleNode<T, KEYTYPE> * FindNodeFromKey (KEYTYPE key);
  48. };
  49. #include "dlist.inl"
  50. #endif