asyncTaskCollection.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Filename: asyncTaskCollection.h
  2. // Created by: drose (16Sep08)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef ASYNCTASKCOLLECTION_H
  15. #define ASYNCTASKCOLLECTION_H
  16. #include "pandabase.h"
  17. #include "pointerToArray.h"
  18. #include "asyncTask.h"
  19. ////////////////////////////////////////////////////////////////////
  20. // Class : AsyncTaskCollection
  21. // Description :
  22. ////////////////////////////////////////////////////////////////////
  23. class EXPCL_PANDA_PGRAPH AsyncTaskCollection {
  24. PUBLISHED:
  25. AsyncTaskCollection();
  26. AsyncTaskCollection(const AsyncTaskCollection &copy);
  27. void operator = (const AsyncTaskCollection &copy);
  28. INLINE ~AsyncTaskCollection();
  29. void add_task(AsyncTask *task);
  30. bool remove_task(AsyncTask *task);
  31. void add_tasks_from(const AsyncTaskCollection &other);
  32. void remove_tasks_from(const AsyncTaskCollection &other);
  33. void remove_duplicate_tasks();
  34. bool has_task(AsyncTask *task) const;
  35. void clear();
  36. AsyncTask *find_task(const string &name) const;
  37. int get_num_tasks() const;
  38. AsyncTask *get_task(int index) const;
  39. AsyncTask *operator [] (int index) const;
  40. void output(ostream &out) const;
  41. void write(ostream &out, int indent_level = 0) const;
  42. private:
  43. typedef PTA(PT(AsyncTask)) AsyncTasks;
  44. AsyncTasks _tasks;
  45. };
  46. INLINE ostream &operator << (ostream &out, const AsyncTaskCollection &col) {
  47. col.output(out);
  48. return out;
  49. }
  50. #include "asyncTaskCollection.I"
  51. #endif