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.

61 lines
1.6 KiB

  1. /* slist.h
  2. *
  3. * Copyright (c) 1996 by Microsoft Corporation
  4. *
  5. * Written by: Christos Tsollis
  6. *
  7. * Revisions:
  8. *
  9. * Abstract:
  10. *
  11. * This is the interface to a single linked list data structure.
  12. * The values in a list are DWORD values. So, for example, if the
  13. * value is really a pointer, it has to be converted into a DWORD before being passed into a
  14. * member list function.
  15. *
  16. */
  17. #ifndef _SINGLE_LIST2_H_
  18. #define _SINGLE_LIST2_H_
  19. #include <windows.h>
  20. #define DEFAULT_NUMBER_OF_ITEMS 15
  21. class SListClass
  22. {
  23. public:
  24. SListClass (DWORD num_of_items = DEFAULT_NUMBER_OF_ITEMS);
  25. ~SListClass ();
  26. void append (DWORD_PTR new_key);
  27. BOOL find (DWORD_PTR Key);
  28. DWORD_PTR read (DWORD index = 0);
  29. DWORD_PTR get ();
  30. DWORD_PTR removeLast ();
  31. BOOL iterate (DWORD_PTR *pKey);
  32. void prepend (DWORD_PTR new_key);
  33. void remove (DWORD_PTR Key);
  34. void reset () { CurrOffset = 0xFFFFFFFF; }; // resets the list iterator
  35. DWORD entries () { return NumOfEntries; };
  36. // returns the number of entries in the list
  37. void clear () { NumOfEntries = 0; HeadOffset = 0; CurrOffset = 0xFFFFFFFF; };
  38. // clears up the list. The list contains no values afterwards.
  39. BOOL isEmpty () { return ((NumOfEntries == 0) ? TRUE : FALSE); };
  40. private:
  41. DWORD NumOfEntries; // current # of entries in the list
  42. DWORD MaxEntries; // max # of entries that the array can hold
  43. DWORD_PTR *Entries; // Circular array of entries
  44. DWORD HeadOffset; // Offset of the 1st entry in the circular array
  45. DWORD CurrOffset; // Iterator value
  46. BOOL Expand (void);
  47. };
  48. typedef SListClass * PSListClass;
  49. #endif
  50.