diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
| commit | 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca (patch) | |
| tree | ebe7588e89e1aa2ae5376acf85f3a3a7b2ec7e10 /src/spawner.hh | |
Diffstat (limited to 'src/spawner.hh')
| -rw-r--r-- | src/spawner.hh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/spawner.hh b/src/spawner.hh new file mode 100644 index 0000000..c4f511b --- /dev/null +++ b/src/spawner.hh @@ -0,0 +1,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 |
