task-list-32-tasks.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "software-modes.h"
  3. struct TaskControlBlock ;
  4. // TASK LIST *
  5. class TaskList {
  6. // Default constructor
  7. public: inline TaskList (void) : mList (0) {}
  8. // Block a task in list
  9. public: void enterTask (SECTION_MODE_ TaskControlBlock * inTaskPtr) ;
  10. // Remove first task (returns nullptr if list is empty)
  11. public: TaskControlBlock * removeFirstTask (IRQ_MODE) ;
  12. // Remove a task from list
  13. public: void removeTask (SECTION_MODE_ TaskControlBlock * inTaskPtr) ;
  14. // Private property
  15. private: uint32_t mList ;
  16. // No copy
  17. private: TaskList (const TaskList &) = delete ;
  18. private: TaskList & operator = (const TaskList &) = delete ;
  19. // Iterator
  20. public: class Iterator {
  21. public: inline Iterator (IRQ_MODE_ const TaskList & inTaskList) :
  22. mIteratedList (inTaskList.mList) {
  23. }
  24. public: TaskControlBlock * nextTask (IRQ_MODE) ;
  25. // Private property
  26. private: uint32_t mIteratedList ;
  27. // No copy
  28. private: Iterator (const Iterator &) = delete ;
  29. private: Iterator & operator = (const Iterator &) = delete ;
  30. } ;
  31. } ;