10 #include "TypedBrokerServer.hpp"
16 #if defined(HELICS_ENABLE_TCP_CORE) || defined(HELICS_ENABLE_UDP_CORE)
18 # include "gmlc/networking/AsioContextManager.h"
23 # ifdef HELICS_ENABLE_TCP_CORE
24 namespace gmlc::networking {
32 # ifdef HELICS_ENABLE_UDP_CORE
41 class AsioBrokerServer:
public TypedBrokerServer {
43 AsioBrokerServer() =
default;
44 explicit AsioBrokerServer(std::string_view server_name): name_(server_name) {}
47 const std::shared_ptr<TypedBrokerServer>& ptr)
override;
50 virtual void processArgs(std::string_view args)
override;
51 void enableTcpServer(
bool enabled) { tcp_enabled_ = enabled; }
52 void enableUdpServer(
bool enabled) { udp_enabled_ = enabled; }
56 # ifdef HELICS_ENABLE_TCP_CORE
57 std::shared_ptr<gmlc::networking::TcpServer> loadTCPserver(asio::io_context& ioctx);
58 static void loadTCPServerData(portData& pdata);
60 tcpDataReceive(
const std::shared_ptr<gmlc::networking::TcpConnection>& connection,
62 size_t bytes_received);
63 std::shared_ptr<gmlc::networking::TcpServer> tcpserver;
66 # ifdef HELICS_ENABLE_UDP_CORE
67 std::shared_ptr<udp::UdpServer> loadUDPserver(asio::io_context& ioctx);
68 static void loadUDPServerData(portData& pdata);
70 bool udpDataReceive(
const std::shared_ptr<udp::UdpServer>& server,
72 size_t bytes_received);
73 std::shared_ptr<udp::UdpServer> udpserver;
77 std::thread mainLoopThread;
78 std::mutex threadGuard;
80 const Json::Value* config_{
nullptr};
81 const std::string name_;
82 bool tcp_enabled_{
false};
83 bool udp_enabled_{
false};
96 void enableTcpServer(
bool ) {}
97 void enableUdpServer(
bool ) {}
100 const std::shared_ptr<TypedBrokerServer>& )
override
Definition: AsioBrokerServer.hpp:92
virtual void startServer(const Json::Value *, const std::shared_ptr< TypedBrokerServer > &) override
Definition: AsioBrokerServer.hpp:99
virtual void stopServer() override
Definition: AsioBrokerServer.hpp:104
Definition: TypedBrokerServer.hpp:24
virtual void processArgs(std::string_view args)
Definition: TypedBrokerServer.cpp:99
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14