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