aboutsummaryrefslogtreecommitdiff
path: root/apps/SoilMoistureIo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/SoilMoistureIo.cpp')
-rw-r--r--apps/SoilMoistureIo.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/SoilMoistureIo.cpp b/apps/SoilMoistureIo.cpp
index ad8a3bb..c9cfa1e 100644
--- a/apps/SoilMoistureIo.cpp
+++ b/apps/SoilMoistureIo.cpp
@@ -15,7 +15,7 @@ void VectorSampleOutputStream::write(SampleRecord sample) {
samples.emplace_back(sample);
}
-CsvSampleOutputStream::CsvSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict)
+CsvSampleOutputStream::CsvSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict)
: stream(move(stream)), headerWritten(false), dict(dict) {
}
@@ -84,7 +84,7 @@ void CsvSampleOutputStream::writeHeader() {
s << endl;
}
-JsonSampleOutputStream::JsonSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict) :
+JsonSampleOutputStream::JsonSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict) :
dict(dict), stream(move(stream)) {
}
@@ -121,7 +121,7 @@ void JsonSampleOutputStream::write(SampleRecord sample) {
*stream.get() << doc << endl;
}
-SqlSampleOutputStream::SqlSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict, string table_name) :
+SqlSampleOutputStream::SqlSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict, string table_name) :
dict(dict), stream(move(stream)), table_name(table_name) {
}
@@ -217,8 +217,8 @@ void CsvSampleParser::process_line(shared_ptr<vector<uint8_t>> packet) {
auto value = static_cast<string>(what[2]);
start = what[0].second;
- map<string, string> values;
- values[name] = value;
+
+
auto key = dict.indexOf(name);
sample.set(key, value);
@@ -259,8 +259,8 @@ string to_string(const sample_format_type &arg) {
}
unique_ptr<SampleStreamParser> open_sample_input_stream(
- KeyDictionary &dict,
shared_ptr<SampleOutputStream> output,
+ KeyDictionary &dict,
sample_format_type type) {
if (type == sample_format_type::CSV) {
return make_unique<CsvSampleParser>(output, dict);
@@ -272,7 +272,7 @@ unique_ptr<SampleStreamParser> open_sample_input_stream(
}
unique_ptr<SampleOutputStream> open_sample_output_stream(
- unique_ptr<ostream> output,
+ shared_ptr<ostream> output,
KeyDictionary &dict,
sample_format_type type) {