9#include "../core/CoreTypes.hpp"
10#include "../core/helicsCLI11.hpp"
11#include "NetworkBroker.hpp"
18constexpr const char* tstr[] = {
"default",
35constexpr const char* tcodeStr(
int tcode)
37 return ((tcode >= 0) && (tcode < 15)) ? tstr[tcode] : tstr[15];
40constexpr const char* defInterface[] = {
"127.0.0.1",
46template<
class COMMS, gmlc::networking::InterfaceTypes baseline,
int tcode>
50 netInfo.server_mode = NetworkBrokerData::ServerModeOptions::SERVER_DEFAULT_ACTIVE;
53template<
class COMMS, gmlc::networking::InterfaceTypes baseline,
int tcode>
60template<
class COMMS, gmlc::networking::InterfaceTypes baseline,
int tcode>
64 CLI::App_p netApp = netInfo.commandLineParser(defInterface[
static_cast<int>(baseline)],
false);
65 app->add_subcommand(netApp);
69template<
class COMMS, gmlc::networking::InterfaceTypes baseline,
int tcode>
72 std::lock_guard<std::mutex> lock(dataMutex);
73 if ((netInfo.brokerName.empty()) && (netInfo.brokerAddress.empty())) {
84 if (netInfo.portNumber < 0) {
91template<
class COMMS, gmlc::networking::InterfaceTypes baseline,
int tcode>
94 using InterfaceTypes = gmlc::networking::InterfaceTypes;
99 std::lock_guard<std::mutex> lock(dataMutex);
101 case InterfaceTypes::TCP:
102 case InterfaceTypes::IP:
103 case InterfaceTypes::UDP:
104 if (!netInfo.localInterface.empty() && (netInfo.localInterface.back() ==
'*')) {
105 add = gmlc::networking::makePortAddress(
106 netInfo.localInterface.substr(0, netInfo.localInterface.size() - 1),
109 add = gmlc::networking::makePortAddress(netInfo.localInterface,
113 case InterfaceTypes::INPROC:
114 case InterfaceTypes::IPC:
116 if (!netInfo.localInterface.empty()) {
117 add = netInfo.localInterface;
bool observer
flag indicating that the broker is an observer only
Definition BrokerBase.hpp:91
Time networkTimeout
timeout to establish a socket connection before giving up
Definition BrokerBase.hpp:67
bool useJsonSerialization
Definition BrokerBase.hpp:152
Definition CommsBroker.hpp:21
Definition CoreBroker.hpp:98
virtual std::shared_ptr< helicsCLI11App > generateCLI() override
Definition CoreBroker.cpp:2447
virtual void setAsRoot() override final
Definition CoreBroker.cpp:2471
virtual const std::string & getIdentifier() const override final
Definition CoreBroker.hpp:306
ServerModeOptions server_mode
setup a server mode
Definition NetworkBrokerData.hpp:58
NetworkBroker(bool rootBroker=false) noexcept
Definition NetworkBroker_impl.hpp:47
virtual bool brokerConnect() override
Definition NetworkBroker_impl.hpp:70
NetworkBrokerData netInfo
structure containing the networking information
Definition NetworkBroker.hpp:31
virtual std::shared_ptr< helicsCLI11App > generateCLI() override
Definition NetworkBroker_impl.hpp:61
virtual std::string generateLocalAddressString() const override
Definition NetworkBroker_impl.hpp:92
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition AsyncFedCallInfo.hpp:14