summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp9
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.hpp5
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-raw.cpp9
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-raw.hpp6
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.cpp11
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.hpp2
6 files changed, 9 insertions, 33 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index d115f00..835f724 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
@@ -22,15 +22,6 @@
namespace utils
{
- /// @brief Construct a default, invalid, socket.
- socketcan_bcm_t::socketcan_bcm_t()
- : socketcan_t{}
- {}
-
- /// @brief Destruct the socket.
- socketcan_bcm_t::~socketcan_bcm_t()
- {}
-
/// @brief Connect the socket.
/// @return 0 if success.
int socketcan_bcm_t::connect(const struct sockaddr* addr, socklen_t len)
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
index c0a1bb2..deb30c6 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.hpp
@@ -37,10 +37,7 @@ namespace utils
class socketcan_bcm_t : public socketcan_t
{
public:
- socketcan_bcm_t();
- socketcan_bcm_t(const socketcan_bcm_t&);
- socketcan_bcm_t(socketcan_bcm_t&&);
- virtual ~socketcan_bcm_t();
+ using socketcan_t::socketcan_t;
virtual int open(std::string device_name);
diff --git a/CAN-binder/low-can-binding/utils/socketcan-raw.cpp b/CAN-binder/low-can-binding/utils/socketcan-raw.cpp
index 23f8332..589f6ab 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-raw.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-raw.cpp
@@ -22,15 +22,6 @@
namespace utils
{
- /// @brief Construct a default, invalid, socket.
- socketcan_raw_t::socketcan_raw_t()
- : socketcan_t{}
- {}
-
- /// @brief Destruct the socket.
- socketcan_raw_t::~socketcan_raw_t()
- {}
-
/// @brief Bind the socket.
/// @return 0 if success.
int socketcan_raw_t::bind(const struct sockaddr* addr, socklen_t len)
diff --git a/CAN-binder/low-can-binding/utils/socketcan-raw.hpp b/CAN-binder/low-can-binding/utils/socketcan-raw.hpp
index 71573da..e18ff1f 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-raw.hpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-raw.hpp
@@ -23,11 +23,7 @@ namespace utils
class socketcan_raw_t : public socketcan_t
{
public:
- socketcan_raw_t();
- socketcan_raw_t(const socketcan_raw_t&);
- socketcan_raw_t(socketcan_raw_t&&);
- virtual ~socketcan_raw_t();
-
+ using socketcan_t::socketcan_t;
virtual int open(std::string device_name);
private:
diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp
index 4d22654..f52aaa6 100644
--- a/CAN-binder/low-can-binding/utils/socketcan.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan.cpp
@@ -31,6 +31,11 @@ namespace utils
: socket_{INVALID_SOCKET}
{}
+ /// @brief Construct a socket by copying an existing one.
+ socketcan_t::socketcan_t(const socketcan_t& s)
+ : socket_{s.socket_}
+ {}
+
/// @brief Construct a socket by moving an existing one.
socketcan_t::socketcan_t(socketcan_t&& s)
: socket_{s.socket_}
@@ -38,12 +43,8 @@ namespace utils
s.socket_ = INVALID_SOCKET;
}
- /// @brief Destruct the socket.
socketcan_t::~socketcan_t()
- {
- if(socket_ != INVALID_SOCKET)
- ::close(socket_);
- }
+ {}
const struct sockaddr_can& socketcan_t::get_tx_address() const
{
diff --git a/CAN-binder/low-can-binding/utils/socketcan.hpp b/CAN-binder/low-can-binding/utils/socketcan.hpp
index e911664..76b5121 100644
--- a/CAN-binder/low-can-binding/utils/socketcan.hpp
+++ b/CAN-binder/low-can-binding/utils/socketcan.hpp
@@ -34,7 +34,7 @@ namespace utils
{
public:
socketcan_t();
- socketcan_t(const socketcan_t&);
+ socketcan_t(const socketcan_t& s);
socketcan_t(socketcan_t&&);
virtual ~socketcan_t();