aboutsummaryrefslogtreecommitdiff
path: root/apps/SoilMoistureIo.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/SoilMoistureIo.h')
-rw-r--r--apps/SoilMoistureIo.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/SoilMoistureIo.h b/apps/SoilMoistureIo.h
index 473c098..0d93d2a 100644
--- a/apps/SoilMoistureIo.h
+++ b/apps/SoilMoistureIo.h
@@ -39,12 +39,12 @@ class KeyDictionary;
class SampleKey;
unique_ptr<SampleStreamParser> open_sample_input_stream(
- KeyDictionary &dict,
shared_ptr<SampleOutputStream> output,
+ KeyDictionary &dict,
sample_format_type type = sample_format_type::AUTO);
unique_ptr<SampleOutputStream> open_sample_output_stream(
- unique_ptr<ostream> output,
+ shared_ptr<ostream> output,
KeyDictionary &dict,
sample_format_type type);
@@ -121,7 +121,7 @@ public:
indexes.push_back(index);
}
- return move(indexes);
+ return indexes;
}
inline
@@ -190,7 +190,7 @@ public:
void set(const SampleKey *key, const std::string &value) {
values.resize(max(values.size(), key->index + 1));
- values.assign(key->index, o<string>(value));
+ values.at(key->index) = o<string>(value);
}
template<class A>
@@ -242,7 +242,7 @@ public:
class CsvSampleOutputStream : public SampleOutputStream {
public:
- CsvSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict);
+ CsvSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict);
void write(SampleRecord sample);
@@ -254,30 +254,30 @@ private:
void writeHeader();
KeyDictionary &dict;
- unique_ptr<ostream> stream;
+ shared_ptr<ostream> stream;
bool headerWritten;
};
class JsonSampleOutputStream : public SampleOutputStream {
public:
- JsonSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict);
+ JsonSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict);
void write(SampleRecord sample) override;
private:
KeyDictionary &dict;
- unique_ptr<ostream> stream;
+ shared_ptr<ostream> stream;
};
class SqlSampleOutputStream : public SampleOutputStream {
public:
- SqlSampleOutputStream(unique_ptr<ostream> stream, KeyDictionary &dict, string table_name);
+ SqlSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict, string table_name);
void write(SampleRecord sample) override;
private:
KeyDictionary &dict;
- unique_ptr<ostream> stream;
+ shared_ptr<ostream> stream;
const string table_name;
};
@@ -296,6 +296,7 @@ protected:
}
};
+// TODO: rename to "KeyValueParser", this is not CSV.
class CsvSampleParser : public SampleStreamParser {
public: