Skip to content

Commit be0644a

Browse files
committed
[Communication] Move BaseSocketCommunication destructor to header to fix C++20 compilation
1 parent 0006aaa commit be0644a

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

co_sim_io/includes/communication/base_socket_communication.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,19 @@ class CO_SIM_IO_API BaseSocketCommunication : public Communication
3939
std::shared_ptr<DataCommunicator> I_DataComm)
4040
: Communication(I_Settings, I_DataComm) {}
4141

42-
~BaseSocketCommunication() override;
42+
/// Destructor
43+
~BaseSocketCommunication() override
44+
{
45+
CO_SIM_IO_TRY
46+
47+
if (GetIsConnected()) {
48+
CO_SIM_IO_INFO("CoSimIO") << "Warning: Disconnect was not performed, attempting automatic disconnection!" << std::endl;
49+
Info tmp;
50+
Disconnect(tmp);
51+
}
52+
53+
CO_SIM_IO_CATCH
54+
}
4355

4456
Info ConnectDetail(const Info& I_Info) override;
4557

co_sim_io/sources/communication/base_socket_communication.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@
1818
namespace CoSimIO {
1919
namespace Internals {
2020

21-
template<class TSocketType>
22-
BaseSocketCommunication<TSocketType>::~BaseSocketCommunication()
23-
{
24-
CO_SIM_IO_TRY
25-
26-
if (GetIsConnected()) {
27-
CO_SIM_IO_INFO("CoSimIO") << "Warning: Disconnect was not performed, attempting automatic disconnection!" << std::endl;
28-
Info tmp;
29-
Disconnect(tmp);
30-
}
31-
32-
CO_SIM_IO_CATCH
33-
}
34-
3521
template<class TSocketType>
3622
Info BaseSocketCommunication<TSocketType>::ConnectDetail(const Info& I_Info)
3723
{

0 commit comments

Comments
 (0)