|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
27 #ifndef SIMULATOR_SIMULATORFACTORY_H
28 #define SIMULATOR_SIMULATORFACTORY_H
54 bool registerClass(std::string
id,
bool isInteractive) {
55 if (mapObjectCreator.find(
id) != mapObjectCreator.end()) {
59 mapObjectCreator.insert(std::pair<std::string, CreateSimulatorFunctionPointer>(
id, &createTheSimulator<C>));
60 mapObjectCreator2.insert(std::pair<std::string, CreateSimulatorFunctionPointer2>(
id, &createTheSimulator2<C>));
61 mapInteractive.insert(std::pair<std::string, bool>(
id, isInteractive));
63 interactiveSimulators.push_back(
id);
66 nonInteractiveSimulators.push_back(
id);
73 bool isRegistered(std::string
id);
82 int getNumberOfInteractiveSimulators();
85 int getNumberOfNonInteractiveSimulators();
88 std::string getInteractiveSimulator(
const unsigned int index);
91 std::string getNonInteractiveSimulator(
const unsigned int index);
94 bool isInteractive(std::string
id);
105 std::map<std::string, CreateSimulatorFunctionPointer> mapObjectCreator;
108 std::map<std::string, CreateSimulatorFunctionPointer2> mapObjectCreator2;
121 return new C(monitoringManager);
135 return new C(monitoringManager, file);
139 std::map<std::string, bool> mapInteractive;
142 std::vector<std::string> interactiveSimulators;
145 std::vector<std::string> nonInteractiveSimulators;
153 #endif // SIMULATOR_SIMULATORFACTORY_H
A factory to create Simulator.
Definition: SimulatorFactory.h:40
std::map< std::string, CreateSimulatorFunctionPointer > mapObjectCreator
A map between Simulator name as string to functions.
Definition: SimulatorFactory.h:128
static SimulatorFactory * instance
unique instance of the factory
Definition: SimulatorFactory.h:171
#define MML_API
Definition: MMLAPI.h:43
static SimulatorFactory * getInstance()
return the unique instance of the factory
Definition: SimulatorFactory.cpp:56
std::string getNonInteractiveSimulator(const unsigned int index)
get a non interactive simulator name by its index
Definition: SimulatorFactory.cpp:74
A simulator engine is used to compute the displacements of all atoms of the model.
Definition: Simulator.h:46
bool isInteractive(std::string id)
return true if the registered simulator id is interactive
Definition: SimulatorFactory.cpp:94
std::map< std::string, bool > mapInteractive
map between Simulator name as string to booleen, true if interactive
Definition: SimulatorFactory.h:162
bool isRegistered(std::string id)
Returns true if id is in the map.
Definition: SimulatorFactory.cpp:32
std::vector< std::string > nonInteractiveSimulators
list of non interactive simulators
Definition: SimulatorFactory.h:168
int getNumberOfInteractiveSimulators()
give the number of interactive simulators registered
Definition: SimulatorFactory.cpp:84
int getNumberOfNonInteractiveSimulators()
give the number of interactive simulators registered
Definition: SimulatorFactory.cpp:89
SimulatorFactory()=default
std::string getInteractiveSimulator(const unsigned int index)
get a interactive simulator name by its index
Definition: SimulatorFactory.cpp:64
std::map< std::string, CreateSimulatorFunctionPointer2 > mapObjectCreator2
A map between Simulator name as string to functions (for the 2nd constructor that uses a simulator fi...
Definition: SimulatorFactory.h:131
Manager of the benchmark tests. Do simulation loop and tests.
Definition: MonitoringManager.h:50
Simulator * createSimulator(std::string id, MonitoringManager *monitoringManager)
Creates a Simulator based on its string id or return nullptr if there is no id in the map.
Definition: SimulatorFactory.cpp:37
std::vector< std::string > interactiveSimulators
list of interactive simulators
Definition: SimulatorFactory.h:165