summaryrefslogtreecommitdiff
path: root/src/spawner.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/spawner.hh')
-rw-r--r--src/spawner.hh49
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