00001 #ifndef __SCHEDULER_H__ 00002 #define __SCHEDULER_H__ 00003 00004 #include <map> 00005 #include <set> 00006 #include <utility> 00007 #include "stm_export.h" 00008 00009 namespace control { 00010 00012 class STM_EXPORT Scheduler 00013 { 00014 public: 00015 enum JobStatus 00016 { 00017 UNKNOWN, 00018 PENDING, 00019 STARTED, 00020 COMPLETE 00021 }; 00022 00023 void Clear(void); 00024 void AddNode(int); 00025 bool AddEdge(int, int); 00026 00027 void Invalidate(int); 00028 void SetStarted(int); 00029 void SetComplete(int); 00030 00031 void ClearProgress(void); 00032 void SetProgress(int, float); 00033 00034 void GetNextScheduledJobs(std::set<int> &) const; 00035 00036 void GetCompletedJobs(std::set<int> &) const; 00037 void GetPendingJobs(std::set<int> &) const; 00038 void GetStartedJobs(std::set<int> &) const; 00039 00040 float GetProgress(int) const; 00041 JobStatus GetStatus(int) const; 00042 00043 private: 00044 std::map<int, std::pair<JobStatus,float> > m_status; 00045 std::set<std::pair<int, int> > m_dependencies; 00046 }; 00047 00048 } 00049 00050 #endif