From 1c1c43e97fa98051ccc6494cf0facf303f119e5b Mon Sep 17 00:00:00 2001 From: Patrick McMichael Date: Mon, 15 Jun 2015 12:49:01 -0400 Subject: [PATCH] Update to Serial::setTimeout (and unix/win implementations) to accept timeout by const reference (Addresses issue #101) --- include/serial/impl/unix.h | 2 +- include/serial/impl/win.h | 2 +- include/serial/serial.h | 4 ++-- src/impl/unix.cc | 2 +- src/impl/win.cc | 2 +- src/serial.cc | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/serial/impl/unix.h b/include/serial/impl/unix.h index 0fb38f24..f20525c0 100644 --- a/include/serial/impl/unix.h +++ b/include/serial/impl/unix.h @@ -141,7 +141,7 @@ class serial::Serial::SerialImpl { getPort () const; void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); Timeout getTimeout () const; diff --git a/include/serial/impl/win.h b/include/serial/impl/win.h index 2c0c6cde..e689875d 100644 --- a/include/serial/impl/win.h +++ b/include/serial/impl/win.h @@ -130,7 +130,7 @@ class serial::Serial::SerialImpl { getPort () const; void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); Timeout getTimeout () const; diff --git a/include/serial/serial.h b/include/serial/serial.h index 82dc2996..1bf02f3c 100644 --- a/include/serial/serial.h +++ b/include/serial/serial.h @@ -179,7 +179,7 @@ class Serial { */ Serial (const std::string &port = "", uint32_t baudrate = 9600, - Timeout timeout = Timeout(), + const Timeout &timeout = Timeout(), bytesize_t bytesize = eightbits, parity_t parity = parity_none, stopbits_t stopbits = stopbits_one, @@ -456,7 +456,7 @@ class Serial { * \see serial::Timeout */ void - setTimeout (Timeout &timeout); + setTimeout (const Timeout &timeout); /*! Sets the timeout for reads and writes. */ void diff --git a/src/impl/unix.cc b/src/impl/unix.cc index 0b7ab42c..850febd7 100755 --- a/src/impl/unix.cc +++ b/src/impl/unix.cc @@ -699,7 +699,7 @@ Serial::SerialImpl::getPort () const } void -Serial::SerialImpl::setTimeout (serial::Timeout &timeout) +Serial::SerialImpl::setTimeout (const serial::Timeout &timeout) { timeout_ = timeout; } diff --git a/src/impl/win.cc b/src/impl/win.cc index 92a5c629..13dc8fd8 100644 --- a/src/impl/win.cc +++ b/src/impl/win.cc @@ -370,7 +370,7 @@ Serial::SerialImpl::getPort () const } void -Serial::SerialImpl::setTimeout (serial::Timeout &timeout) +Serial::SerialImpl::setTimeout (const serial::Timeout &timeout) { timeout_ = timeout; if (is_open_) { diff --git a/src/serial.cc b/src/serial.cc index 7b2d2a47..6c8d214b 100755 --- a/src/serial.cc +++ b/src/serial.cc @@ -63,7 +63,7 @@ class Serial::ScopedWriteLock { SerialImpl *pimpl_; }; -Serial::Serial (const string &port, uint32_t baudrate, serial::Timeout timeout, +Serial::Serial (const string &port, uint32_t baudrate, const serial::Timeout &timeout, bytesize_t bytesize, parity_t parity, stopbits_t stopbits, flowcontrol_t flowcontrol) : pimpl_(new SerialImpl (port, baudrate, bytesize, parity, @@ -279,7 +279,7 @@ Serial::getPort () const } void -Serial::setTimeout (serial::Timeout &timeout) +Serial::setTimeout (const serial::Timeout &timeout) { pimpl_->setTimeout (timeout); }