| helics 3.6.1

TcpCommsSS.h
1 /*
2 Copyright (c) 2017-2025,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #pragma once
8
9 #include "../NetworkCommsInterface.hpp"
10
11 #include <atomic>
12 #include <set>
13 #include <string>
14 #include <vector>
15
16 namespace gmlc::networking {
17 class TcpConnection;
18 }
19
20 namespace helics {
21 namespace tcp {
22
24 class TcpCommsSS final: public NetworkCommsInterface {
25 public:
27 TcpCommsSS() noexcept;
29 ~TcpCommsSS();
30
32 void addConnection(std::string_view newConn);
34 void addConnections(const std::vector<std::string>& newConnections);
36 virtual void setFlag(std::string_view flag, bool val) override;
37
39 virtual void loadNetworkInfo(const NetworkBrokerData& netInfo) override;
40
41 private:
43 bool outgoingConnectionsAllowed{true};
44 bool reuse_address{false};
45 std::string encryption_config;
46 std::vector<std::string> connections;
47 virtual int getDefaultBrokerPort() const override;
48 virtual void queue_rx_function() override;
49 virtual void queue_tx_function() override;
50
53 int processIncomingMessage(ActionMessage&& cmd);
54
61 size_t dataReceive(gmlc::networking::TcpConnection* connection,
62 const char* data,
63 size_t bytes_received);
64 // bool errorHandle()
65 };
66
67 } // namespace tcp
68 } // namespace helics
helics::ActionMessage
Definition: ActionMessage.hpp:30
helics::NetworkBrokerData
Definition: NetworkBrokerData.hpp:23
helics::NetworkCommsInterface
Definition: NetworkCommsInterface.hpp:18
helics::tcp::TcpCommsSS
Definition: TcpCommsSS.h:24
helics::tcp::TcpCommsSS::addConnection
void addConnection(std::string_view newConn)
Definition: TcpCommsSS.cpp:56
helics::tcp::TcpCommsSS::addConnections
void addConnections(const std::vector< std::string > &newConnections)
Definition: TcpCommsSS.cpp:64
helics::tcp::TcpCommsSS::~TcpCommsSS
~TcpCommsSS()
Definition: TcpCommsSS.cpp:34
helics::tcp::TcpCommsSS::loadNetworkInfo
virtual void loadNetworkInfo(const NetworkBrokerData &netInfo) override
Definition: TcpCommsSS.cpp:40
helics::tcp::TcpCommsSS::setFlag
virtual void setFlag(std::string_view flag, bool val) override
Definition: TcpCommsSS.cpp:77
helics::tcp::TcpCommsSS::TcpCommsSS
TcpCommsSS() noexcept
Definition: TcpCommsSS.cpp:27
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14