blob: c4f511b445f4081d106be57bd967561381ccedd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef SPAWNER_HH
#define SPAWNER_HH
#include <cstdint>
#include <expected>
#include <memory>
namespace io {
class Reader;
class Writer;
}; // namespace io
class Process {
public:
virtual ~Process() = default;
virtual io::Reader& reader() const = 0;
virtual io::Writer& writer() const = 0;
protected:
Process() = default;
Process(Process const&) = delete;
Process& operator=(Process const&) = delete;
};
class Spawner {
public:
enum class Exec : uint8_t {
kImageProcessor,
};
enum class Error : uint8_t {
kError,
};
virtual ~Spawner() = default;
[[nodiscard]]
virtual std::expected<std::unique_ptr<Process>, Error> run(Exec exec) = 0;
static std::expected<std::unique_ptr<Spawner>, Error> create();
protected:
Spawner() = default;
Spawner(Spawner const&) = delete;
Spawner& operator=(Spawner const&) = delete;
};
#endif // SPAWNER_HH
|