diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-08 00:07:31 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-08 00:07:31 +0100 |
commit | 7088a4a5639b27a4c82eb6f6560ec1f1fd538fd4 (patch) | |
tree | 21b33d8860fe6ab0ac690dbe8ea0eba00525eec4 /apps/SoilMoistureIo.h | |
parent | f2b544edddebf0701bad20a889197e650ffa1e56 (diff) | |
download | ble-toys-7088a4a5639b27a4c82eb6f6560ec1f1fd538fd4.tar.gz ble-toys-7088a4a5639b27a4c82eb6f6560ec1f1fd538fd4.tar.bz2 ble-toys-7088a4a5639b27a4c82eb6f6560ec1f1fd538fd4.tar.xz ble-toys-7088a4a5639b27a4c82eb6f6560ec1f1fd538fd4.zip |
o Dynamic input and output types.
Diffstat (limited to 'apps/SoilMoistureIo.h')
-rw-r--r-- | apps/SoilMoistureIo.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/apps/SoilMoistureIo.h b/apps/SoilMoistureIo.h index aff7c85..4edf4f4 100644 --- a/apps/SoilMoistureIo.h +++ b/apps/SoilMoistureIo.h @@ -34,7 +34,7 @@ public: return entries.end(); } - string& operator[](string key) { + string &operator[](string key) { return entries[key]; } @@ -49,34 +49,46 @@ public: class CsvSampleOutputStream : public SampleOutputStream { public: - CsvSampleOutputStream(ostream& stream, vector<string> fields); + CsvSampleOutputStream(ostream &stream); + + CsvSampleOutputStream(ostream &stream, vector<string> fields); void write(Sample values); private: - ostream& stream; + void writeHeader(); + + ostream &stream; + bool headerWritten; + bool filterFields; vector<string> fields; }; class JsonSampleOutputStream : public SampleOutputStream { public: - JsonSampleOutputStream(ostream& stream, vector<string> fields); + JsonSampleOutputStream(ostream &stream); + + JsonSampleOutputStream(ostream &stream, vector<string> fields); void write(Sample values); private: - ostream& stream; + ostream &stream; + bool filterFields; vector<string> fields; }; class SqlSampleOutputStream : public SampleOutputStream { public: - SqlSampleOutputStream(ostream& stream, vector<string> fields); + SqlSampleOutputStream(ostream &stream); + + SqlSampleOutputStream(ostream &stream, vector<string> fields); void write(Sample values); private: - ostream& stream; + ostream &stream; + bool filterFields; vector<string> fields; }; |