Skip to content

Commit

Permalink
Update to Serial::setTimeout (and unix/win implementations) to accept…
Browse files Browse the repository at this point in the history
… timeout by const reference (Addresses issue wjwwood#101)
  • Loading branch information
theidealist committed Jun 15, 2015
1 parent 99e57e6 commit 1c1c43e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/serial/impl/unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class serial::Serial::SerialImpl {
getPort () const;

void
setTimeout (Timeout &timeout);
setTimeout (const Timeout &timeout);

Timeout
getTimeout () const;
Expand Down
2 changes: 1 addition & 1 deletion include/serial/impl/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class serial::Serial::SerialImpl {
getPort () const;

void
setTimeout (Timeout &timeout);
setTimeout (const Timeout &timeout);

Timeout
getTimeout () const;
Expand Down
4 changes: 2 additions & 2 deletions include/serial/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/impl/unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ Serial::SerialImpl::getPort () const
}

void
Serial::SerialImpl::setTimeout (serial::Timeout &timeout)
Serial::SerialImpl::setTimeout (const serial::Timeout &timeout)
{
timeout_ = timeout;
}
Expand Down
2 changes: 1 addition & 1 deletion src/impl/win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down
4 changes: 2 additions & 2 deletions src/serial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -279,7 +279,7 @@ Serial::getPort () const
}

void
Serial::setTimeout (serial::Timeout &timeout)
Serial::setTimeout (const serial::Timeout &timeout)
{
pimpl_->setTimeout (timeout);
}
Expand Down

0 comments on commit 1c1c43e

Please sign in to comment.