helics  3.5.2
ZmqComms.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 
8 #pragma once
9 
10 #include "../NetworkCommsInterface.hpp"
11 
12 #include <atomic>
13 #include <set>
14 #include <string>
15 
16 namespace zmq {
17 class message_t;
18 class socket_t;
19 } // namespace zmq
20 namespace helics {
21 namespace zeromq {
23  class ZmqComms final: public NetworkCommsInterface {
24  public:
26  ZmqComms() noexcept;
28  ~ZmqComms();
30  virtual void loadNetworkInfo(const NetworkBrokerData& netInfo) override;
33  private:
34  virtual int getDefaultBrokerPort() const override;
35  virtual void queue_rx_function() override;
36  virtual void queue_tx_function() override;
37  virtual void closeReceiver() override;
38 
41  int processIncomingMessage(zmq::message_t& msg);
44  int replyToIncomingMessage(zmq::message_t& msg, zmq::socket_t& sock);
45 
46  int initializeBrokerConnections(zmq::socket_t& controlSocket);
47 
48  public:
49  std::string getPushAddress() const;
50  };
51 
52 } // namespace zeromq
53 } // namespace helics
Definition: NetworkBrokerData.hpp:23
Definition: NetworkCommsInterface.hpp:18
Definition: ZmqComms.h:23
virtual void loadNetworkInfo(const NetworkBrokerData &netInfo) override
Definition: ZmqComms.cpp:31
ZmqComms() noexcept
Definition: ZmqComms.cpp:57
~ZmqComms()
Definition: ZmqComms.cpp:60
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14