diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-19 21:55:23 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-03-19 21:55:23 +0100 |
commit | 97ad73ac5c0e8955fcc0478d12075423c8023e84 (patch) | |
tree | 6f903dcf51ddca76962d895b68028d86f3c9bd5a /apps/SoilMoistureIo.h | |
parent | 17de795175d0573d8ac6c2517d0eb35e8a4f8f69 (diff) | |
download | ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.gz ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.bz2 ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.tar.xz ble-toys-97ad73ac5c0e8955fcc0478d12075423c8023e84.zip |
o Fixing key-value output.
Diffstat (limited to 'apps/SoilMoistureIo.h')
-rw-r--r-- | apps/SoilMoistureIo.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apps/SoilMoistureIo.h b/apps/SoilMoistureIo.h index 3e78f46..fac518c 100644 --- a/apps/SoilMoistureIo.h +++ b/apps/SoilMoistureIo.h @@ -169,21 +169,21 @@ public: } inline - vec::const_iterator begin() { - return values.begin(); + vec::const_iterator cbegin() const { + return values.cbegin(); } inline - vec::const_iterator end() { - return values.end(); + vec::const_iterator cend() const { + return values.cend(); } inline - bool empty() { + bool empty() const { return values.empty(); } - o<string> at(const SampleKey *key) const { + const o<string> at(const SampleKey *key) const { SampleKeyIndex index = key->index; if (index >= values.size()) { return o<string>(); @@ -195,11 +195,11 @@ public: void set(const SampleKey *key, const std::string &value) { values.resize(max(values.size(), key->index + 1)); - values.at(key->index) = o<string>(value); + values.at(key->index).reset(value); } template<class A> - const o<A> lexical_at(const SampleKey *key) { + const o<A> lexical_at(const SampleKey *key) const { auto value = at(key); if (!value) { @@ -233,13 +233,13 @@ private: class SampleOutputStream { public: - virtual void write(SampleRecord sample) = 0; + virtual void write(SampleRecord const &sample) = 0; }; class VectorSampleOutputStream : public SampleOutputStream { public: - virtual void write(SampleRecord sample) override; + virtual void write(SampleRecord const &sample) override; public: vector<SampleRecord> samples; @@ -249,7 +249,7 @@ class CsvSampleOutputStream : public SampleOutputStream { public: CsvSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict); - void write(SampleRecord sample); + void write(SampleRecord const &sample); const KeyDictionary &getDict() { return dict; @@ -267,7 +267,7 @@ class JsonSampleOutputStream : public SampleOutputStream { public: JsonSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict); - void write(SampleRecord sample) override; + void write(SampleRecord const &sample) override; private: KeyDictionary &dict; @@ -278,7 +278,7 @@ class KeyValueSampleOutputStream : public SampleOutputStream { public: KeyValueSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict); - void write(SampleRecord sample) override; + void write(SampleRecord const &sample) override; private: KeyDictionary &dict; @@ -289,7 +289,7 @@ class SqlSampleOutputStream : public SampleOutputStream { public: SqlSampleOutputStream(shared_ptr<ostream> stream, KeyDictionary &dict, string table_name); - void write(SampleRecord sample) override; + void write(SampleRecord const &sample) override; private: KeyDictionary &dict; |