From be0644af07871b788c7bee600ec8dc2e0a7fccf9 Mon Sep 17 00:00:00 2001 From: Vicente Mataix Ferrandiz Date: Wed, 29 Oct 2025 15:25:10 +0100 Subject: [PATCH] [Communication] Move `BaseSocketCommunication` destructor to header to fix C++20 compilation --- .../communication/base_socket_communication.hpp | 14 +++++++++++++- .../communication/base_socket_communication.cpp | 14 -------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/co_sim_io/includes/communication/base_socket_communication.hpp b/co_sim_io/includes/communication/base_socket_communication.hpp index 3f26756a..5650f843 100644 --- a/co_sim_io/includes/communication/base_socket_communication.hpp +++ b/co_sim_io/includes/communication/base_socket_communication.hpp @@ -39,7 +39,19 @@ class CO_SIM_IO_API BaseSocketCommunication : public Communication std::shared_ptr I_DataComm) : Communication(I_Settings, I_DataComm) {} - ~BaseSocketCommunication() override; + /// Destructor + ~BaseSocketCommunication() override + { + CO_SIM_IO_TRY + + if (GetIsConnected()) { + CO_SIM_IO_INFO("CoSimIO") << "Warning: Disconnect was not performed, attempting automatic disconnection!" << std::endl; + Info tmp; + Disconnect(tmp); + } + + CO_SIM_IO_CATCH + } Info ConnectDetail(const Info& I_Info) override; diff --git a/co_sim_io/sources/communication/base_socket_communication.cpp b/co_sim_io/sources/communication/base_socket_communication.cpp index 8f71c4c1..e8c9878d 100644 --- a/co_sim_io/sources/communication/base_socket_communication.cpp +++ b/co_sim_io/sources/communication/base_socket_communication.cpp @@ -18,20 +18,6 @@ namespace CoSimIO { namespace Internals { -template -BaseSocketCommunication::~BaseSocketCommunication() -{ - CO_SIM_IO_TRY - - if (GetIsConnected()) { - CO_SIM_IO_INFO("CoSimIO") << "Warning: Disconnect was not performed, attempting automatic disconnection!" << std::endl; - Info tmp; - Disconnect(tmp); - } - - CO_SIM_IO_CATCH -} - template Info BaseSocketCommunication::ConnectDetail(const Info& I_Info) {