From 7edc4328bfd5eee557108ebdb4243ca06914c41e Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 17 Mar 2015 22:56:47 +0100 Subject: o cout and unique_ptr became complicated. o Updating lots of code to the latest api. --- apps/SoilMoistureIo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'apps/SoilMoistureIo.cpp') 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 stream, KeyDictionary &dict) +CsvSampleOutputStream::CsvSampleOutputStream(shared_ptr stream, KeyDictionary &dict) : stream(move(stream)), headerWritten(false), dict(dict) { } @@ -84,7 +84,7 @@ void CsvSampleOutputStream::writeHeader() { s << endl; } -JsonSampleOutputStream::JsonSampleOutputStream(unique_ptr stream, KeyDictionary &dict) : +JsonSampleOutputStream::JsonSampleOutputStream(shared_ptr 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 stream, KeyDictionary &dict, string table_name) : +SqlSampleOutputStream::SqlSampleOutputStream(shared_ptr 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> packet) { auto value = static_cast(what[2]); start = what[0].second; - map 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 open_sample_input_stream( - KeyDictionary &dict, shared_ptr output, + KeyDictionary &dict, sample_format_type type) { if (type == sample_format_type::CSV) { return make_unique(output, dict); @@ -272,7 +272,7 @@ unique_ptr open_sample_input_stream( } unique_ptr open_sample_output_stream( - unique_ptr output, + shared_ptr output, KeyDictionary &dict, sample_format_type type) { -- cgit v1.2.3