helics  2.8.1
cxx_shared_library/CoreFactory.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/CoreApp.hpp"
10 #include "Core.hpp"
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 
16 namespace helics {
17 #define HELICS_SHARED_DEPRECATED_CORE \
18  [[deprecated( \
19  "Core Factory deprecated for use in the C++ shared library use CoreApp instead if you " \
20  "really need the functionality and it is not available in CoreApp either link to the static " \
21  "library and/or contact the developers to " \
22  "potentially add it to CoreApp")]]
23 
29 namespace CoreFactory {
35  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
36  create(core_type type, const std::string& coreName, const std::string& initializationString)
37  {
38  CoreApp cr(type, coreName, initializationString);
39  return cr.getCopyofCorePointer();
40  }
46  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
47  create(core_type type, const std::string& initializationString)
48  {
49  CoreApp cr(type, initializationString);
50  return cr.getCopyofCorePointer();
51  }
52 
58  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
59  create(core_type type, int argc, char* argv[])
60  {
61  CoreApp cr(type, argc, argv);
62  return cr.getCopyofCorePointer();
63  }
64 
71  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core> create(std::vector<std::string> args)
72  {
73  CoreApp cr(args);
74  return cr.getCopyofCorePointer();
75  }
76 
81  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core> create(core_type type,
82  std::vector<std::string> args)
83  {
84  CoreApp cr(type, args);
85  return cr.getCopyofCorePointer();
86  }
87 
95  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core> create(int argc, char* argv[])
96  {
97  CoreApp cr(argc, argv);
98  return cr.getCopyofCorePointer();
99  }
100 
108  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
109  create(core_type type, const std::string& coreName, int argc, char* argv[])
110  {
111  CoreApp cr(type, coreName, argc, argv);
112  return cr.getCopyofCorePointer();
113  }
114 
121  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
122  create(core_type type, const std::string& coreName, std::vector<std::string> args)
123  {
124  CoreApp cr(type, coreName, args);
125  return cr.getCopyofCorePointer();
126  }
127 
130  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
131  FindOrCreate(core_type type,
132  const std::string& coreName,
133  const std::string& initializationString)
134  {
135  CoreApp cr(type, coreName, initializationString);
136  return cr.getCopyofCorePointer();
137  }
138 
141  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
142  FindOrCreate(core_type type, const std::string& coreName, int argc, char* argv[])
143  {
144  CoreApp cr(type, coreName, argc, argv);
145  return cr.getCopyofCorePointer();
146  }
147 
150  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core>
151  FindOrCreate(core_type type, const std::string& coreName, std::vector<std::string> args)
152  {
153  CoreApp cr(type, coreName, args);
154  return cr.getCopyofCorePointer();
155  }
156 
158  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core> findJoinableCoreOfType(core_type type)
159  {
160  return nullptr;
161  }
162 
166  HELICS_SHARED_DEPRECATED_CORE std::shared_ptr<Core> findCore(const std::string& name)
167  {
168  return nullptr;
169  }
170 
176  HELICS_SHARED_DEPRECATED_CORE bool registerCore(const std::shared_ptr<Core>& core) {}
177 
181  HELICS_SHARED_DEPRECATED_CORE void unregisterCore(const std::string& name) {}
187  HELICS_SHARED_DEPRECATED_CORE size_t cleanUpCores() { return 0; }
194  HELICS_SHARED_DEPRECATED_CORE size_t cleanUpCores(std::chrono::milliseconds delay) { return 0; }
195 
199  HELICS_SHARED_DEPRECATED_CORE bool copyCoreIdentifier(const std::string& copyFromName,
200  const std::string& copyToName)
201  {
202  return false;
203  }
204 
205 } // namespace CoreFactory
206 
207 } // namespace helics
helics::core_type
core_type
Definition: core-types.hpp:37
helics::CoreFactory::FindOrCreate
std::shared_ptr< Core > FindOrCreate(core_type type, const std::string &coreName, std::vector< std::string > args)
Definition: CoreFactory.cpp:180
helics::CoreFactory::copyCoreIdentifier
bool copyCoreIdentifier(const std::string &copyFromName, const std::string &copyToName)
Definition: CoreFactory.cpp:342
helics::CoreFactory::findJoinableCoreOfType
std::shared_ptr< Core > findJoinableCoreOfType(core_type type)
Definition: CoreFactory.cpp:272
helics::CoreFactory::registerCore
bool registerCore(const std::shared_ptr< Core > &core, core_type type)
Definition: CoreFactory.cpp:298
helics::CoreFactory::findCore
std::shared_ptr< Core > findCore(const std::string &name)
Definition: CoreFactory.cpp:267
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::CoreFactory::cleanUpCores
size_t cleanUpCores()
Definition: CoreFactory.cpp:313
helics::CoreFactory::unregisterCore
void unregisterCore(const std::string &name)
Definition: CoreFactory.cpp:347