OpenMD 3.1
Molecular Dynamics in the Open
|
Factory pattern and Singleton Pattern are used to define an interface for creating an HydrodynamicsModel. More...
#include <HydrodynamicsModelFactory.hpp>
Public Types | |
using | CreatorMapType = std::map<std::string, HydrodynamicsModelCreator*> |
using | IdentVectorType = std::vector<std::string> |
using | IdentVectorIterator = std::vector<std::string>::iterator |
Public Member Functions | |
bool | registerHydrodynamicsModel (HydrodynamicsModelCreator *creator) |
Registers a creator with a type identifier. | |
bool | unregisterHydrodynamicsModel (const std::string &id) |
Unregisters the creator for the given type identifier. | |
HydrodynamicsModel * | createHydrodynamicsModel (const std::string &id) |
Looks up the type identifier in the internal map. | |
IdentVectorType | getIdents () |
Returns all of the registed type identifiers. | |
Static Public Member Functions | |
static HydrodynamicsModelFactory * | getInstance () |
Returns an instance of HydrodynamicsModel factory. | |
Factory pattern and Singleton Pattern are used to define an interface for creating an HydrodynamicsModel.
Definition at line 72 of file HydrodynamicsModelFactory.hpp.
using OpenMD::HydrodynamicsModelFactory::CreatorMapType = std::map<std::string, HydrodynamicsModelCreator*> |
Definition at line 74 of file HydrodynamicsModelFactory.hpp.
using OpenMD::HydrodynamicsModelFactory::IdentVectorIterator = std::vector<std::string>::iterator |
Definition at line 76 of file HydrodynamicsModelFactory.hpp.
using OpenMD::HydrodynamicsModelFactory::IdentVectorType = std::vector<std::string> |
Definition at line 75 of file HydrodynamicsModelFactory.hpp.
OpenMD::HydrodynamicsModelFactory::~HydrodynamicsModelFactory | ( | ) |
Definition at line 57 of file HydrodynamicsModelFactory.cpp.
HydrodynamicsModel * OpenMD::HydrodynamicsModelFactory::createHydrodynamicsModel | ( | const std::string & | id | ) |
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 of the concrete object |
sd | a pointer to the StuntDouble being modeled |
info | a pointer to the SimInfo object |
Definition at line 73 of file HydrodynamicsModelFactory.cpp.
std::vector< std::string > OpenMD::HydrodynamicsModelFactory::getIdents | ( | ) |
Returns all of the registed type identifiers.
Definition at line 84 of file HydrodynamicsModelFactory.cpp.
Referenced by OpenMD::operator<<().
|
inlinestatic |
Returns an instance of HydrodynamicsModel factory.
Definition at line 84 of file HydrodynamicsModelFactory.hpp.
bool OpenMD::HydrodynamicsModelFactory::registerHydrodynamicsModel | ( | HydrodynamicsModelCreator * | creator | ) |
Registers a creator with a type identifier.
creator | the object responsible to create the concrete object |
Definition at line 61 of file HydrodynamicsModelFactory.cpp.
bool OpenMD::HydrodynamicsModelFactory::unregisterHydrodynamicsModel | ( | 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 68 of file HydrodynamicsModelFactory.cpp.