helics  3.3.0
TcpBroker.h
1 /*
2 Copyright (c) 2017-2022,
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 "../../core/CoreTypes.hpp"
10 #include "../NetworkBroker.hpp"
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 
16 namespace helics {
17 namespace tcp {
18  class TcpComms;
19  class TcpCommsSS;
21  using TcpBroker = NetworkBroker<TcpComms,
22  gmlc::networking::InterfaceTypes::TCP,
23  static_cast<int>(CoreType::TCP)>;
24 
26  class TcpBrokerSS final:
27  public NetworkBroker<TcpCommsSS,
28  gmlc::networking::InterfaceTypes::TCP,
29  static_cast<int>(CoreType::TCP_SS)> {
30  public:
32  explicit TcpBrokerSS(bool rootBroker = false) noexcept;
33  explicit TcpBrokerSS(std::string_view broker_name);
34 
35  protected:
36  virtual std::shared_ptr<helicsCLI11App> generateCLI() override;
37 
38  private:
39  virtual bool brokerConnect() override;
40  bool no_outgoing_connections = false;
41  std::vector<std::string>
42  connections;
43  };
45 
46 } // namespace tcp
47 } // namespace helics
helics::tcp::TcpBrokerSS::TcpBrokerSS
TcpBrokerSS(bool rootBroker=false) noexcept
Definition: TcpBroker.cpp:23
helics::NetworkBroker
Definition: NetworkBroker.hpp:18
helics::NetworkBroker< TcpCommsSS, gmlc::networking::InterfaceTypes::TCP, static_cast< int >(CoreType::TCP_SS)>::dataMutex
std::mutex dataMutex
mutex protecting the configuration information
Definition: NetworkBroker.hpp:30
helics::NetworkBroker::generateCLI
virtual std::shared_ptr< helicsCLI11App > generateCLI() override
Definition: NetworkBroker_impl.hpp:61
helics::NetworkBroker::brokerConnect
virtual bool brokerConnect() override
Definition: NetworkBroker_impl.hpp:70
helics::CommsBroker< TcpCommsSS, CoreBroker >::comms
std::unique_ptr< TcpCommsSS > comms
the actual comms object
Definition: CommsBroker.hpp:24
helics::tcp::TcpBrokerSS::generateCLI
virtual std::shared_ptr< helicsCLI11App > generateCLI() override
Definition: TcpBroker.cpp:27
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::tcp::TcpBrokerSS
Definition: TcpBroker.h:26
helics::CoreType::TCP
@ TCP
use a generic TCP protocol message stream to send messages