]> git.tdb.fi Git - builder.git/blob - source/chainedtask.h
Inline simple constructors
[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 = 0;
16         Status final_status = RUNNING;
17
18 public:
19         ChainedTask(Task *t) { add_task(t); }
20         ~ChainedTask();
21
22         void add_task(Task *);
23
24         std::string get_command() const override;
25         void start() override;
26         Status check() override;
27         Status wait() override;
28 private:
29         bool process(Status);
30 };
31
32 #endif