From d35da77dcd5273b54177f8bc8ae7e5992bb3ca09 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 24 May 2017 00:00:33 +0200 Subject: [PATCH] Be able to copy active diagnostic request objects with their socket Implement socket copy assignment operator on socketcan base class. Change-Id: I75a2d3b96275b7ab83372d74ff7fe0a0b0535dc7 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp | 1 + CAN-binder/low-can-binding/utils/socketcan.cpp | 6 ++++++ CAN-binder/low-can-binding/utils/socketcan.hpp | 1 + 3 files changed, 8 insertions(+) diff --git a/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp b/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp index e657456f..e9f0cd10 100644 --- a/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp +++ b/CAN-binder/low-can-binding/diagnostic/active-diagnostic-request.cpp @@ -45,6 +45,7 @@ active_diagnostic_request_t& active_diagnostic_request_t::operator=(const active wait_for_multiple_responses_ = adr.wait_for_multiple_responses_; frequency_clock_ = adr.frequency_clock_; timeout_clock_ = adr.timeout_clock_; + socket_ = adr.socket_; } return *this; diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp index d66822de..ffd46151 100644 --- a/CAN-binder/low-can-binding/utils/socketcan.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan.cpp @@ -43,6 +43,12 @@ namespace utils s.socket_ = INVALID_SOCKET; } + socketcan_t& socketcan_t::operator=(const socketcan_t& s) + { + socket_ = std::move(s.socket_); + return *this; + } + socketcan_t::~socketcan_t() {} diff --git a/CAN-binder/low-can-binding/utils/socketcan.hpp b/CAN-binder/low-can-binding/utils/socketcan.hpp index c3abb2ff..1e7cd3cb 100644 --- a/CAN-binder/low-can-binding/utils/socketcan.hpp +++ b/CAN-binder/low-can-binding/utils/socketcan.hpp @@ -35,6 +35,7 @@ namespace utils socketcan_t(); socketcan_t(const socketcan_t& s); socketcan_t(socketcan_t&&); + socketcan_t& operator=(const socketcan_t& s); virtual ~socketcan_t(); const struct sockaddr_can& get_tx_address() const; -- 2.16.6