aboutsummaryrefslogtreecommitdiff
path: root/apps/sample-add-timestamp.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/sample-add-timestamp.h')
-rw-r--r--apps/sample-add-timestamp.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/sample-add-timestamp.h b/apps/sample-add-timestamp.h
index 711cf49..8439519 100644
--- a/apps/sample-add-timestamp.h
+++ b/apps/sample-add-timestamp.h
@@ -13,11 +13,9 @@ using namespace trygvis::sensor::io;
namespace po = boost::program_options;
class TimestampAddingSampleOutputStream : public SampleOutputStream {
-
public:
TimestampAddingSampleOutputStream(shared_ptr<SampleOutputStream> output, KeyDictionary &dict, string timestamp_name)
- :
- timestamp_key(dict.indexOf(timestamp_name)) {
+ : timestamp_key(dict.indexOf(timestamp_name)) {
if (input_time_resolution_ == time_resolution::MILLISECONDS) {
factor = 1000;
} else {
@@ -43,7 +41,6 @@ private:
};
class sample_add_timestamp : public app {
-
private:
string timestamp_name;
time_resolution resolution;
@@ -56,10 +53,10 @@ public:
~sample_add_timestamp() = default;
void add_options(po::options_description_easy_init &options) override {
- options
- ("resolution", po::value<time_resolution>(&resolution)->default_value(time_resolution::SECONDS))
- ("timestamp-name", po::value<string>(&timestamp_name)->default_value("timestamp"))
- ("output-format", po::value<sample_format_type>(&output_format)->default_value(sample_format_type::KEY_VALUE));
+ options("resolution", po::value<time_resolution>(&resolution)->default_value(time_resolution::SECONDS));
+ options("timestamp-name", po::value<string>(&timestamp_name)->default_value("timestamp"));
+ options("output-format",
+ po::value<sample_format_type>(&output_format)->default_value(sample_format_type::KEY_VALUE));
}
const int buffer_size = 1024;
@@ -72,9 +69,10 @@ public:
KeyDictionary dict;
sample_output_stream_options options = {};
- unique_ptr<SampleOutputStream> unique_output_stream = open_sample_output_stream(shared_ptr<ostream>(&cout, noop_deleter), dict, output_format, options);
+ auto unique_output_stream =
+ open_sample_output_stream(shared_ptr<ostream>(&cout, noop_deleter), dict, output_format, options);
shared_ptr<SampleOutputStream> output_stream{std::move(unique_output_stream)};
- shared_ptr<SampleOutputStream> p = make_shared<TimestampAddingSampleOutputStream>(output_stream, dict, timestamp_name);
+ auto p = make_shared<TimestampAddingSampleOutputStream>(output_stream, dict, timestamp_name);
auto parser = open_sample_stream_parser(p, dict);
int recordCount = 0;
@@ -82,7 +80,7 @@ public:
while (!input->eof()) {
char buffer[buffer_size];
input->read(buffer, buffer_size);
- size_t gcount = (size_t)input->gcount();
+ size_t gcount = (size_t) input->gcount();
recordCount++;
@@ -93,6 +91,5 @@ public:
return EXIT_SUCCESS;
};
};
-
}
}