helics  3.5.2
TcpCommsSS.h
1 /*
2 Copyright (c) 2017-2024,
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
Definition: ActionMessage.hpp:30
Definition: NetworkBrokerData.hpp:23
Definition: NetworkCommsInterface.hpp:18
Definition: TcpCommsSS.h:24
void addConnection(std::string_view newConn)
Definition: TcpCommsSS.cpp:55
void addConnections(const std::vector< std::string > &newConnections)
Definition: TcpCommsSS.cpp:63
~TcpCommsSS()
Definition: TcpCommsSS.cpp:33
virtual void loadNetworkInfo(const NetworkBrokerData &netInfo) override
Definition: TcpCommsSS.cpp:39
virtual void setFlag(std::string_view flag, bool val) override
Definition: TcpCommsSS.cpp:76
TcpCommsSS() noexcept
Definition: TcpCommsSS.cpp:26
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14