]> git.tdb.fi Git - builder.git/blob - source/chainedtask.h
Add utility class for executing chains of tasks
[builder.git] / source / chainedtask.h
1 #ifndef CHAINEDTASK_H_
2 #define CHAINEDTASK_H_
3
4 #include <vector>
5 #include "task.h"
6
7 /**
8 Runs multiple tasks as one unit, one after the other.  Execution of the chain
9 will stop if any of the component tasks terminates with an error.
10 */
11 class ChainedTask: public Task
12 {
13 private:
14         std::vector<Task *> tasks;
15         unsigned current;
16         Status final_status;
17
18 public:
19         ChainedTask(Task *);
20         ~ChainedTask();
21
22         void add_task(Task *);
23
24         virtual std::string get_command() const;
25         virtual void start();
26         virtual Status check();
27         virtual Status wait();
28 private:
29         bool process(Status);
30 };
31
32 #endif