From efa1825dd6d16e7901e9620c31796b27b6c84ee9 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 14 Mar 2015 17:33:43 +0100 Subject: o Creating a tool to calculate an absolute timestamp from a relative timestamp. o Using git submodules instead of CMake's external project. --- apps/sm-serial-read.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'apps/sm-serial-read.cpp') diff --git a/apps/sm-serial-read.cpp b/apps/sm-serial-read.cpp index fee1a8c..04a718d 100644 --- a/apps/sm-serial-read.cpp +++ b/apps/sm-serial-read.cpp @@ -59,7 +59,7 @@ string hostname = get_hostname(); class port_handler { public: - port_handler(string device, serial_port &serial_port, shared_ptr input) : + port_handler(string device, serial_port &serial_port, shared_ptr input) : device(device), port(serial_port), input(input) { } @@ -84,7 +84,7 @@ private: uint8_t data[size]; mutable_buffers_1 buffer = boost::asio::buffer(data, size); - shared_ptr input; + shared_ptr input; }; class sm_serial_read : public app { @@ -120,20 +120,21 @@ public: cerr << "port is not open" << endl; } - shared_ptr output; + shared_ptr output; + unique_ptr outputStream = unique_ptr(&cout); if (format == Format::JSON) { - output = make_shared(cout); + output = make_shared(std::move(outputStream)); } else if (format == Format::SQL) { - output = make_shared(cout, "raw"); + output = make_shared(std::move(outputStream), "raw"); } else if (format == Format::PLAIN) { - output = make_shared(cout); + output = make_shared(std::move(outputStream)); } else { cerr << "Unsupported format: " << boost::lexical_cast(format) << endl; return EXIT_FAILURE; } - shared_ptr input = make_shared(output); + shared_ptr input = make_shared(output); port_handler(port_name, port, input).run(); -- cgit v1.2.3