Team Fortress 2 Source Code as on 22/4/2020
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.

58 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // ObjectList.h: interface for the ObjectList class.
  9. //
  10. //////////////////////////////////////////////////////////////////////
  11. #ifndef OBJECTLIST_H
  12. #define OBJECTLIST_H
  13. #pragma once
  14. #include "IObjectContainer.h" // Added by ClassView
  15. class ObjectList : public IObjectContainer
  16. {
  17. public:
  18. void Init();
  19. bool Add( void * newObject );
  20. void * GetFirst();
  21. void * GetNext();
  22. ObjectList();
  23. virtual ~ObjectList();
  24. void Clear( bool freeElementsMemory );
  25. int CountElements();
  26. void * RemoveTail();
  27. void * RemoveHead();
  28. bool AddTail(void * newObject);
  29. bool AddHead(void * newObject);
  30. bool Remove(void * object);
  31. bool Contains(void * object);
  32. bool IsEmpty();
  33. typedef struct element_s {
  34. element_s * prev; // pointer to the last element or NULL
  35. element_s * next; // pointer to the next elemnet or NULL
  36. void * object; // the element's object
  37. } element_t;
  38. protected:
  39. element_t * head; // first element in list
  40. element_t * tail; // last element in list
  41. element_t * current; // current element in list
  42. int number;
  43. };
  44. #endif // !defined