OpenMD 3.1
Molecular Dynamics in the Open
|
Factory pattern and Singleton Pattern are used to define an interface for creating an Lattice. More...
#include <LatticeFactory.hpp>
Public Types | |
using | CreatorMapType = std::map<std::string, LatticeCreator*> |
using | IdentVectorType = std::vector<std::string> |
using | IdentVectorIterator = std::vector<std::string>::iterator |
Public Member Functions | |
bool | registerLattice (LatticeCreator *creator) |
Registers a creator with a type identifier. | |
bool | unregisterLattice (const std::string &id) |
Unregisters the creator for the given type identifier. | |
Lattice * | createLattice (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 LatticeFactory & | getInstance () |
Returns an instance of Lattice factory. | |
Factory pattern and Singleton Pattern are used to define an interface for creating an Lattice.
Definition at line 71 of file LatticeFactory.hpp.
using OpenMD::LatticeFactory::CreatorMapType = std::map<std::string, LatticeCreator*> |
Definition at line 73 of file LatticeFactory.hpp.
using OpenMD::LatticeFactory::IdentVectorIterator = std::vector<std::string>::iterator |
Definition at line 75 of file LatticeFactory.hpp.
using OpenMD::LatticeFactory::IdentVectorType = std::vector<std::string> |
Definition at line 74 of file LatticeFactory.hpp.
Lattice * OpenMD::LatticeFactory::createLattice | ( | 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 |
Definition at line 64 of file LatticeFactory.cpp.
std::vector< std::string > OpenMD::LatticeFactory::getIdents | ( | ) |
Returns all of the registed type identifiers.
Definition at line 74 of file LatticeFactory.cpp.
Referenced by OpenMD::operator<<().
|
inlinestatic |
Returns an instance of Lattice factory.
Definition at line 81 of file LatticeFactory.hpp.
Referenced by OpenMD::registerLattice().
bool OpenMD::LatticeFactory::registerLattice | ( | LatticeCreator * | creator | ) |
Registers a creator with a type identifier.
creator | the object responsible to create the concrete object |
Definition at line 54 of file LatticeFactory.cpp.
Referenced by OpenMD::registerLattice().
bool OpenMD::LatticeFactory::unregisterLattice | ( | 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 60 of file LatticeFactory.cpp.