diff options
Diffstat (limited to 'sensor/main')
-rw-r--r-- | sensor/main/io.cpp | 30 | ||||
-rw-r--r-- | sensor/main/sensor.cpp | 2 |
2 files changed, 16 insertions, 16 deletions
diff --git a/sensor/main/io.cpp b/sensor/main/io.cpp index 96a98f6..9e822c3 100644 --- a/sensor/main/io.cpp +++ b/sensor/main/io.cpp @@ -45,17 +45,17 @@ unique_ptr<SampleOutputStream> open_sample_output_stream( auto tsf = options.find_option<timestamp_field_option>(); - auto timestamp_key = dict.indexOf(tsf ? tsf.get()->name : "timestamp"); + auto timestamp_key = dict.indexOf(tsf ? tsf.value()->name : "timestamp"); return make_unique<RrdSampleOutputStream>(output, dict, timestamp_key, of); } else if (type == sample_format_type::SQL) { auto tno = options.find_option<table_name_option>(); - if (!tno.is_initialized()) { + if (!tno) { throw missing_required_option_error("table name"); } - return make_unique<SqlSampleOutputStream>(move(output), dict, tno.get()->name); + return make_unique<SqlSampleOutputStream>(move(output), dict, tno.value()->name); } else { throw sample_exception("No writer for format type: " + to_string(type)); } @@ -144,7 +144,7 @@ void CsvSampleOutputStream::write(SampleRecord const &sample) { auto o = sample.at(sampleKey); if (o) { - s << o.get(); + s << o.value(); } } @@ -152,7 +152,7 @@ void CsvSampleOutputStream::write(SampleRecord const &sample) { } void CsvSampleOutputStream::writeHeader() { - auto &s = *stream.get(); + auto &s = *stream; auto i = dict.begin(); while (i != dict.end()) { @@ -187,7 +187,7 @@ void JsonSampleOutputStream::write(SampleRecord const &sample) { auto value = sample.at(sampleKey); if (value) { - doc[key->name] = value.get(); + doc[key->name] = value.value(); } } } else { @@ -197,7 +197,7 @@ void JsonSampleOutputStream::write(SampleRecord const &sample) { if (o) { // Make sure that the key is registered in the dictionary dict.indexOf(sampleKey->name); - doc[sampleKey->name] = o.get(); + doc[sampleKey->name] = o.value(); } } } @@ -230,7 +230,7 @@ void KeyValueSampleOutputStream::write(SampleRecord const &sample) { } else { *s << ", "; } - *s << key->name << "=" << value.get(); + *s << key->name << "=" << value.value(); } } } else { @@ -245,7 +245,7 @@ void KeyValueSampleOutputStream::write(SampleRecord const &sample) { } // Make sure that the key is registered in the dictionary dict.indexOf(sampleKey->name); - *s << sampleKey->name << "=" << o.get(); + *s << sampleKey->name << "=" << o.value(); } } } @@ -260,7 +260,7 @@ RrdSampleOutputStream::RrdSampleOutputStream(shared_ptr<ostream> stream, stream(move(stream)), timestamp_key(timestamp_key) { if (output_fields) { - for (auto field : output_fields.get()->fields) { + for (auto field : output_fields.value()->fields) { keys.emplace_back(dict.indexOf(field)); } } else { @@ -284,7 +284,7 @@ void RrdSampleOutputStream::write(SampleRecord const &sample) { return; } - auto timestamp = timestampO.get(); + auto timestamp = timestampO.value(); s << timestamp; @@ -303,7 +303,7 @@ void RrdSampleOutputStream::write(SampleRecord const &sample) { s << ":"; } - s << (value ? value.get() : "U"); + s << (value ? value.value() : "U"); } s << endl << flush; @@ -319,7 +319,7 @@ void SqlSampleOutputStream::write(SampleRecord const &sample) { fs.reserve(1024); vs.reserve(1024); - auto &s = *stream.get(); + auto &s = *stream; bool first = true; if (!dict.empty()) { @@ -336,7 +336,7 @@ void SqlSampleOutputStream::write(SampleRecord const &sample) { vs += ", "; } fs += "\"" + key->name + "\""; - vs += "'" + value.get() + "'"; + vs += "'" + value.value() + "'"; } } } else { @@ -354,7 +354,7 @@ void SqlSampleOutputStream::write(SampleRecord const &sample) { dict.indexOf(sample_key->name); fs += "\"" + sample_key->name + "\""; - vs += "'" + o.get() + "'"; + vs += "'" + o.value() + "'"; } } } diff --git a/sensor/main/sensor.cpp b/sensor/main/sensor.cpp index 1c0c666..0988e0d 100644 --- a/sensor/main/sensor.cpp +++ b/sensor/main/sensor.cpp @@ -80,7 +80,7 @@ const o<long> SampleRecord::lexical_at(const SampleKey *key) const { return o<long>(); } - return o<long>(boost::lexical_cast<long>(value.get())); + return o<long>(boost::lexical_cast<long>(*value)); } // //template<class A> |