helics  3.5.2
BrokerServer.hpp
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 #include "../core/Broker.hpp"
10 
11 #include <atomic>
12 #include <memory>
13 #include <string>
14 #include <thread>
15 #include <tuple>
16 #include <vector>
17 
18 namespace Json {
19 class Value;
20 }
21 
22 namespace helics {
23 class ActionMessage;
24 class helicsCLI11App;
25 
26 using portData = std::vector<std::tuple<int, bool, std::shared_ptr<Broker>>>;
27 
28 namespace apps {
29  class TypedBrokerServer;
32  class BrokerServer {
33  protected:
34  public:
36  BrokerServer() noexcept;
41  BrokerServer(int argc, char* argv[]);
45  explicit BrokerServer(std::vector<std::string> args);
49  explicit BrokerServer(std::string_view configFile);
51  ~BrokerServer();
53  void startServers();
55  static bool hasActiveBrokers();
57  void forceTerminate();
59  void closeServers();
60 
61  private:
63  std::unique_ptr<helicsCLI11App> generateArgProcessing();
64 
65  private:
66  bool zmq_server{false};
67  bool zmq_ss_server{false};
68  bool tcp_server{false};
69  bool udp_server{false};
70  // bool mpi_server{false}; //!< activate the MPI broker server
71  bool http_server{false};
72  bool websocket_server{false};
73  std::atomic<bool> exitall{false};
74  std::vector<std::shared_ptr<TypedBrokerServer>> servers;
75  std::string configFile_;
76  std::string server_name_;
77  std::unique_ptr<Json::Value> config_;
78  std::string mHttpArgs;
79  std::string mWebSocketArgs;
80  std::string mZmqArgs;
81  std::string mTcpArgs;
82  std::string mUdpArgs;
83  std::string mMpiArgs;
84 
85  public:
86  };
87 } // namespace apps
88 } // namespace helics
Definition: BrokerServer.hpp:32
~BrokerServer()
Definition: BrokerServer.cpp:48
void forceTerminate()
Definition: BrokerServer.cpp:133
void closeServers()
Definition: BrokerServer.cpp:147
void startServers()
Definition: BrokerServer.cpp:53
BrokerServer() noexcept
Definition: BrokerServer.cpp:24
static bool hasActiveBrokers()
Definition: BrokerServer.cpp:128
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14