Command.h
branchv_0
changeset 11 3798b6bc9aea
child 24 c31fdd965028
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Command.h	Sat Jul 28 14:06:53 2018 +0200
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
+#include <algorithm>
+
+
+namespace relpipe {
+namespace in {
+namespace cli {
+
+class Command {
+public:
+	virtual ~Command() = default;
+
+	/**
+	 * Processes the inputs (stream + arguments) and generates output in the relational pipes format.
+	 * 
+	 * @param input usually STDIN, may not be used if all data are passed as CLI arguments
+	 * @param output usually STDOUT, relational data is passed here
+	 * @param command command name, usualy not needed, may be significant if the same Command instance is used for several commands
+	 * @param arguments CLI arguments containing data or parameters (format is specific to each command)
+	 */
+	virtual void process(std::istream& input, std::ostream& output, const relpipe::writer::string_t& command, const std::vector<relpipe::writer::string_t> &arguments) = 0;
+
+};
+
+}
+}
+}