helics  2.8.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/core-types.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 =
22  NetworkBroker<TcpComms, interface_type::tcp, static_cast<int>(core_type::TCP)>;
23 
25  class TcpBrokerSS final:
26  public NetworkBroker<TcpCommsSS, interface_type::tcp, static_cast<int>(core_type::TCP_SS)> {
27  public:
29  explicit TcpBrokerSS(bool rootBroker = false) noexcept;
30  explicit TcpBrokerSS(const std::string& broker_name);
31 
32  protected:
33  virtual std::shared_ptr<helicsCLI11App> generateCLI() override;
34 
35  private:
36  virtual bool brokerConnect() override;
37  bool no_outgoing_connections = false;
38  std::vector<std::string>
39  connections;
40  };
42 
43 } // namespace tcp
44 } // namespace helics
helics::tcp::TcpBrokerSS::TcpBrokerSS
TcpBrokerSS(bool rootBroker=false) noexcept
Definition: TcpBroker.cpp:21
helics::NetworkBroker
Definition: NetworkBroker.hpp:18
helics::NetworkBroker< TcpCommsSS, interface_type::tcp, static_cast< int >(core_type::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::core_type::TCP
@ TCP
use a generic TCP protocol message stream to send messages
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:25