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.

35 lines
569 B

  1. #ifndef KList_h
  2. #define KList_h
  3. typedef void* POS;
  4. template <class T>
  5. class KList{
  6. public:
  7. KList();
  8. ~KList();
  9. void empty();
  10. bool addTail(const T& t);
  11. bool addHead(const T& t);
  12. T& getTail() const;
  13. T& getHead() const;
  14. POS getHeadPosition() const;
  15. T& getAt(POS& P);
  16. T& getNext(POS& P);
  17. void removeHead();
  18. void removeTail();
  19. void removeAt(POS& P);
  20. int getCount() const {return count;};
  21. protected:
  22. struct Node{
  23. T Obj;
  24. Node* last;
  25. Node* next;
  26. };
  27. Node* head;
  28. Node* tail;
  29. int count;
  30. };
  31. #include "KList.cpp"
  32. #endif