summaryrefslogtreecommitdiff
path: root/task.h
diff options
context:
space:
mode:
Diffstat (limited to 'task.h')
-rw-r--r--task.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/task.h b/task.h
index 443b6b7..2dd05e3 100644
--- a/task.h
+++ b/task.h
@@ -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;
};