helics  3.0.1
TcpBroker.h
1 /*
2 Copyright (c) 2017-2021,
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, InterfaceTypes::TCP, static_cast<int>(CoreType::TCP)>;
22 
24  class TcpBrokerSS final:
25  public NetworkBroker<TcpCommsSS, InterfaceTypes::TCP, static_cast<int>(CoreType::TCP_SS)> {
26  public:
28  explicit TcpBrokerSS(bool rootBroker = false) noexcept;
29  explicit TcpBrokerSS(const std::string& broker_name);
30 
31  protected:
32  virtual std::shared_ptr<helicsCLI11App> generateCLI() override;
33 
34  private:
35  virtual bool brokerConnect() override;
36  bool no_outgoing_connections = false;
37  std::vector<std::string>
38  connections;
39  };
41 
42 } // namespace tcp
43 } // namespace helics
helics::tcp::TcpBrokerSS::TcpBrokerSS
TcpBrokerSS(bool rootBroker=false) noexcept
Definition: TcpBroker.cpp:21
helics::NetworkBroker
Definition: NetworkBroker.hpp:18
helics::NetworkBroker< TcpCommsSS, 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:25
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:24
helics::CoreType::TCP
@ TCP
use a generic TCP protocol message stream to send messages