diff options
Diffstat (limited to 'task.h')
-rw-r--r-- | task.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -3,13 +3,30 @@ #include <vector> #include <string> +#include <atomic> +#include <list> +#include <memory> class Task { public: - virtual bool dirty() = 0; - virtual int run() = 0; + Task(const std::vector<std::string>& depends); + + void registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks); + + bool dirty(); + bool ready(); + int run(); + bool done() const; virtual int clean() = 0 ; virtual std::vector<std::string> depends() const = 0; virtual std::string target() const = 0; + +protected: + std::atomic<bool> is_done{false}; + virtual int runInner() { return 0; }; + virtual bool dirtyInner() { return false; } + + std::vector<std::string> dependsStr; + std::list<std::shared_ptr<Task>> dependsTasks; }; |