--- trunk/src/lattice/LatticeFactory.hpp 2005/04/12 21:58:09 484 +++ trunk/src/lattice/LatticeFactory.hpp 2005/04/15 22:04:00 507 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a @@ -54,75 +54,75 @@ namespace oopse { #include namespace oopse { -//forward declaration -class Lattice; -class LatticeCreator; -/** - * @class LatticeFactory LatticeFactory.hpp "UseTheForce/LatticeFactory.hpp" - * Factory pattern and Singleton Pattern are used to define an interface for creating an Lattice. - */ -class LatticeFactory { - public: + //forward declaration + class Lattice; + class LatticeCreator; + /** + * @class LatticeFactory LatticeFactory.hpp "UseTheForce/LatticeFactory.hpp" + * Factory pattern and Singleton Pattern are used to define an interface for creating an Lattice. + */ + class LatticeFactory { + public: - typedef std::map CreatorMapType; - typedef std::vector IdentVectorType; - typedef std::vector::iterator IdentVectorIterator; + typedef std::map CreatorMapType; + typedef std::vector IdentVectorType; + typedef std::vector::iterator IdentVectorIterator; - ~LatticeFactory(); + ~LatticeFactory(); - /** - * Returns an instance of Lattice factory - * @return an instance of Lattice factory - */ - static LatticeFactory* getInstance() { + /** + * Returns an instance of Lattice factory + * @return an instance of Lattice factory + */ + static LatticeFactory* getInstance() { - if (instance_ == NULL) { - instance_ = new LatticeFactory(); - } - return instance_; + if (instance_ == NULL) { + instance_ = new LatticeFactory(); + } + return instance_; - } + } - /** - * Registers a creator with a type identifier - * @return true if registration is succeed, otherwise return false - * @id the identification of the concrete object - * @creator the object responsible to create the concrete object - */ - bool registerLattice(LatticeCreator* creator); + /** + * Registers a creator with a type identifier + * @return true if registration is succeed, otherwise return false + * @id the identification of the concrete object + * @creator the object responsible to create the concrete object + */ + bool registerLattice(LatticeCreator* creator); - /** - * Unregisters the creator for the given type identifier. If the type identifier - * was previously registered, the function returns true. - * @return truethe type identifier was previously registered and the creator is removed, - * otherwise return false - * @id the identification of the concrete object - */ - bool unregisterLattice(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. - * @return a pointer of the concrete object, return NULL if no creator is registed for - * creating this concrete object - * @param id the identification of the concrete object - */ - Lattice* createLattice(const std::string& id); + /** + * Unregisters the creator for the given type identifier. If the type identifier + * was previously registered, the function returns true. + * @return truethe type identifier was previously registered and the creator is removed, + * otherwise return false + * @id the identification of the concrete object + */ + bool unregisterLattice(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. + * @return a pointer of the concrete object, return NULL if no creator is registed for + * creating this concrete object + * @param id the identification of the concrete object + */ + Lattice* createLattice(const std::string& id); - /** - * Returns all of the registed type identifiers - * @return all of the registed type identifiers - */ - IdentVectorType getIdents(); + /** + * Returns all of the registed type identifiers + * @return all of the registed type identifiers + */ + IdentVectorType getIdents(); - private: - LatticeFactory() {} + private: + LatticeFactory() {} - static LatticeFactory* instance_; - CreatorMapType creatorMap_; -}; + static LatticeFactory* instance_; + CreatorMapType creatorMap_; + }; -/** write out all of the type identifiers to an output stream */ -std::ostream& operator <<(std::ostream& o, LatticeFactory& factory); + /** write out all of the type identifiers to an output stream */ + std::ostream& operator <<(std::ostream& o, LatticeFactory& factory); }//namespace oopse #endif //USETHEFORCE_FORCEFIELDFACTORY_HPP