OpenMD 3.1
Molecular Dynamics in the Open
|
Factory pattern and Singleton Pattern are used to define an interface for creating an Integrator. More...
#include <IntegratorFactory.hpp>
Public Types | |
using | CreatorMapType = std::map<std::string, IntegratorCreator*> |
using | IdentVectorType = std::vector<std::string> |
using | IdentVectorIterator = std::vector<std::string>::iterator |
Public Member Functions | |
bool | registerIntegrator (IntegratorCreator *creator) |
Registers a creator with a type identifier. | |
bool | unregisterIntegrator (const std::string &id) |
Unregisters the creator for the given type identifier. | |
Integrator * | createIntegrator (const std::string &id, SimInfo *info) |
Looks up the type identifier in the internal map. | |
IdentVectorType | getIdents () |
Returns all of the registed type identifiers. | |
Static Public Member Functions | |
static IntegratorFactory & | getInstance () |
Returns an instance of Integrator factory. | |
Factory pattern and Singleton Pattern are used to define an interface for creating an Integrator.
Definition at line 72 of file IntegratorFactory.hpp.
using OpenMD::IntegratorFactory::CreatorMapType = std::map<std::string, IntegratorCreator*> |
Definition at line 74 of file IntegratorFactory.hpp.
using OpenMD::IntegratorFactory::IdentVectorIterator = std::vector<std::string>::iterator |
Definition at line 76 of file IntegratorFactory.hpp.
using OpenMD::IntegratorFactory::IdentVectorType = std::vector<std::string> |
Definition at line 75 of file IntegratorFactory.hpp.
Integrator * OpenMD::IntegratorFactory::createIntegrator | ( | const std::string & | id, |
SimInfo * | info ) |
Looks up the type identifier in the internal map.
If it is found, it invokes the corresponding creator for the type identifier and returns its result.
id | the identification string of the concrete object |
info | pointer to the concrete SimInfo object |
Definition at line 66 of file IntegratorFactory.cpp.
std::vector< std::string > OpenMD::IntegratorFactory::getIdents | ( | ) |
Returns all of the registed type identifiers.
Definition at line 77 of file IntegratorFactory.cpp.
Referenced by OpenMD::operator<<().
|
inlinestatic |
Returns an instance of Integrator factory.
Definition at line 83 of file IntegratorFactory.hpp.
Referenced by OpenMD::registerIntegrators().
bool OpenMD::IntegratorFactory::registerIntegrator | ( | IntegratorCreator * | creator | ) |
Registers a creator with a type identifier.
creator | the object responsible for creating the concrete object |
Definition at line 56 of file IntegratorFactory.cpp.
Referenced by OpenMD::registerIntegrators().
bool OpenMD::IntegratorFactory::unregisterIntegrator | ( | const std::string & | id | ) |
Unregisters the creator for the given type identifier.
If the type identifier was previously registered, the function returns true.
id | the identification of the concrete object |
Definition at line 62 of file IntegratorFactory.cpp.