48#include "hydrodynamics/HydrodynamicsModel.hpp"
49#include "hydrodynamics/HydrodynamicsModelCreator.hpp"
55 HydrodynamicsModelFactory* HydrodynamicsModelFactory::instance_ = NULL;
57 HydrodynamicsModelFactory::~HydrodynamicsModelFactory() {
58 Utils::deletePointers(creatorMap_);
64 .insert(CreatorMapType::value_type(creator->getIdent(), creator))
69 const std::string&
id) {
70 return creatorMap_.erase(
id) == 1;
74 const std::string&
id) {
75 CreatorMapType::iterator i = creatorMap_.find(
id);
76 if (i != creatorMap_.end()) {
78 return (i->second)->create();
85 IdentVectorType idents;
86 CreatorMapType::iterator i;
88 for (i = creatorMap_.begin(); i != creatorMap_.end(); ++i) {
89 idents.push_back(i->first);
95 std::ostream& operator<<(std::ostream& o,
97 HydrodynamicsModelFactory::IdentVectorType idents;
98 HydrodynamicsModelFactory::IdentVectorIterator i;
102 o <<
"Avaliable type identifiers in this factory: " << std::endl;
103 for (i = idents.begin(); i != idents.end(); ++i) {
104 o << *i << std::endl;
Factory pattern and Singleton Pattern are used to define an interface for creating an HydrodynamicsMo...
bool registerHydrodynamicsModel(HydrodynamicsModelCreator *creator)
Registers a creator with a type identifier.
IdentVectorType getIdents()
Returns all of the registed type identifiers.
HydrodynamicsModel * createHydrodynamicsModel(const std::string &id)
Looks up the type identifier in the internal map.
bool unregisterHydrodynamicsModel(const std::string &id)
Unregisters the creator for the given type identifier.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.