47#include "lattice/LatticeCreator.hpp"
52 LatticeFactory::~LatticeFactory() { Utils::deletePointers(creatorMap_); }
56 .insert(CreatorMapType::value_type(creator->getIdent(), creator))
61 return creatorMap_.erase(
id) == 1;
65 CreatorMapType::iterator i = creatorMap_.find(
id);
66 if (i != creatorMap_.end()) {
68 return (i->second)->create();
75 IdentVectorType idents;
76 CreatorMapType::iterator i;
78 for (i = creatorMap_.begin(); i != creatorMap_.end(); ++i) {
79 idents.push_back(i->first);
86 LatticeFactory::IdentVectorType idents;
87 LatticeFactory::IdentVectorIterator i;
91 o <<
"Avaliable type identifiers in this factory: " << std::endl;
92 for (i = idents.begin(); i != idents.end(); ++i) {
Factory pattern and Singleton Pattern are used to define an interface for creating an Lattice.
Lattice * createLattice(const std::string &id)
Looks up the type identifier in the internal map.
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.
IdentVectorType getIdents()
Returns all of the registed type identifiers.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.