diff options
Diffstat (limited to 'apps/SoilMoistureIo.h')
-rw-r--r-- | apps/SoilMoistureIo.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/SoilMoistureIo.h b/apps/SoilMoistureIo.h new file mode 100644 index 0000000..739758a --- /dev/null +++ b/apps/SoilMoistureIo.h @@ -0,0 +1,56 @@ +#ifndef SOIL_MOISTURE_IO_H +#define SOIL_MOISTURE_IO_H + +#include <ostream> +#include <vector> +#include <map> + +namespace trygvis { +namespace soil_moisture { + +using namespace std; + +class SampleOutputStream { +public: + typedef map<string, string> it; + + virtual void write(it values) = 0; +}; + +class CsvSampleOutputStream : public SampleOutputStream { +public: + CsvSampleOutputStream(ostream& stream, vector<string> fields); + + void write(it values); + +private: + ostream& stream; + vector<string> fields; +}; + +class JsonSampleOutputStream : public SampleOutputStream { +public: + JsonSampleOutputStream(ostream& stream, vector<string> fields); + + void write(it values); + +private: + ostream& stream; + vector<string> fields; +}; + +class SqlSampleOutputStream : public SampleOutputStream { +public: + SqlSampleOutputStream(ostream& stream, vector<string> fields); + + void write(it values); + +private: + ostream& stream; + vector<string> fields; +}; + +} +} + +#endif |