helics  2.8.1
cxx_shared_library/BrokerFactory.hpp
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 "../application_api/BrokerApp.hpp"
10 #include "Broker.hpp"
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 
16 namespace helics {
20 namespace BrokerFactory {
21 #define HELICS_SHARED_DEPRECATED \
22  [[deprecated( \
23  "Broker Factory is deprecated for use in the C++ shared library use BrokerApp instead if you really need the functionality either link to the static library and/or contact the developers with the requirements to potentially add it to BrokerApp")]]
24 
29  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> create(core_type type,
30  const std::string& initializationString)
31  {
32  BrokerApp brk(type, initializationString);
33  return brk.getCopyofBrokerPointer();
34  }
36  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> create(core_type type, int argc, char* argv[])
37  {
38  BrokerApp brk(type, argc, argv);
39  return brk.getCopyofBrokerPointer();
40  }
41 
43  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> create(core_type type,
44  std::vector<std::string> args)
45  {
46  BrokerApp brk(type, args);
47  return brk.getCopyofBrokerPointer();
48  }
49 
50  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> create(core_type type,
51  const std::string& broker_name,
52  const std::string& initializationString)
53  {
54  BrokerApp brk(type, broker_name, initializationString);
55  return brk.getCopyofBrokerPointer();
56  }
57 
58  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker>
59  create(core_type type, const std::string& broker_name, int argc, char* argv[])
60  {
61  BrokerApp brk(type, broker_name, argc, argv);
62  return brk.getCopyofBrokerPointer();
63  }
64 
66  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker>
67  create(core_type type, const std::string& broker_name, std::vector<std::string> args)
68  {
69  BrokerApp brk(type, broker_name, args);
70  return brk.getCopyofBrokerPointer();
71  }
72 
76  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> findBroker(const std::string& brokerName)
77  {
78  return nullptr;
79  }
80 
82  HELICS_SHARED_DEPRECATED std::shared_ptr<Broker> findJoinableBrokerOfType(core_type type)
83  {
84  return nullptr;
85  }
86 
88  HELICS_SHARED_DEPRECATED std::vector<std::shared_ptr<Broker>> getAllBrokers() { return {}; }
89 
91  HELICS_SHARED_DEPRECATED bool brokersActive() { return false; }
92 
98  HELICS_SHARED_DEPRECATED bool registerBroker(const std::shared_ptr<Broker>& broker)
99  {
100  return false;
101  }
105  HELICS_SHARED_DEPRECATED void unregisterBroker(const std::string& name) {}
112  HELICS_SHARED_DEPRECATED size_t cleanUpBrokers() { return 0; }
113 
121  HELICS_SHARED_DEPRECATED size_t cleanUpBrokers(std::chrono::milliseconds delay) { return 0; }
122 
126  HELICS_SHARED_DEPRECATED bool copyBrokerIdentifier(const std::string& copyFromName,
127  const std::string& copyToName)
128  {
129  return false;
130  }
131 
133  HELICS_SHARED_DEPRECATED void displayHelp(core_type type = core_type::UNRECOGNIZED) {}
134 } // namespace BrokerFactory
135 } // namespace helics
helics::BrokerFactory::cleanUpBrokers
size_t cleanUpBrokers()
Definition: BrokerFactory.cpp:266
helics::BrokerFactory::copyBrokerIdentifier
bool copyBrokerIdentifier(const std::string &copyFromName, const std::string &copyToName)
Definition: BrokerFactory.cpp:290
helics::core_type
core_type
Definition: core-types.hpp:37
helics::BrokerFactory::brokersActive
bool brokersActive()
Definition: BrokerFactory.cpp:225
helics::BrokerFactory::displayHelp
void displayHelp(core_type type)
Definition: BrokerFactory.cpp:311
helics::core_type::UNRECOGNIZED
@ UNRECOGNIZED
unknown
helics::BrokerFactory::unregisterBroker
void unregisterBroker(const std::string &name)
Definition: BrokerFactory.cpp:295
helics::BrokerFactory::findBroker
std::shared_ptr< Broker > findBroker(const std::string &brokerName)
Definition: BrokerFactory.cpp:185
helics::BrokerFactory::findJoinableBrokerOfType
std::shared_ptr< Broker > findJoinableBrokerOfType(core_type type)
Definition: BrokerFactory.cpp:217
helics::BrokerFactory::create
std::shared_ptr< Broker > create(core_type type, const std::string &configureString)
Definition: BrokerFactory.cpp:100
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::BrokerFactory::registerBroker
bool registerBroker(const std::shared_ptr< Broker > &broker, core_type type)
Definition: BrokerFactory.cpp:246
helics::BrokerFactory::getAllBrokers
std::vector< std::shared_ptr< Broker > > getAllBrokers()
Definition: BrokerFactory.cpp:223