--- trunk/OOPSE-2.0/src/integrators/IntegratorFactory.hpp 2005/01/12 22:41:40 1930 +++ trunk/OOPSE-2.0/src/integrators/IntegratorFactory.hpp 2005/04/15 22:04:00 2204 @@ -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 Integrator; -class IntegratorCreator; -class SimInfo; -/** - * @class IntegratorFactory IntegratorFactory.hpp "UseTheForce/IntegratorFactory.hpp" - * Factory pattern and Singleton Pattern are used to define an interface for creating an Integrator. - */ -class IntegratorFactory { - public: + //forward declaration + class Integrator; + class IntegratorCreator; + class SimInfo; + /** + * @class IntegratorFactory IntegratorFactory.hpp "UseTheForce/IntegratorFactory.hpp" + * Factory pattern and Singleton Pattern are used to define an interface for creating an Integrator. + */ + class IntegratorFactory { + 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; - ~IntegratorFactory(); + ~IntegratorFactory(); - /** - * Returns an instance of Integrator factory - * @return an instance of Integrator factory - */ - static IntegratorFactory* getInstance() { + /** + * Returns an instance of Integrator factory + * @return an instance of Integrator factory + */ + static IntegratorFactory* getInstance() { - if (instance_ == NULL) { - instance_ = new IntegratorFactory(); - } - return instance_; + if (instance_ == NULL) { + instance_ = new IntegratorFactory(); + } + 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 registerIntegrator(IntegratorCreator* 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 registerIntegrator(IntegratorCreator* 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 unregisterIntegrator(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 - */ - Integrator* createIntegrator(const std::string& id, SimInfo* info); + /** + * 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 unregisterIntegrator(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 + */ + Integrator* createIntegrator(const std::string& id, SimInfo* info); - /** - * 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: - IntegratorFactory() {} - static IntegratorFactory* instance_; - CreatorMapType creatorMap_; -}; + private: + IntegratorFactory() {} + static IntegratorFactory* instance_; + CreatorMapType creatorMap_; + }; -/** write out all of the type identifiers to an output stream */ -std::ostream& operator <<(std::ostream& o, IntegratorFactory& factory); + /** write out all of the type identifiers to an output stream */ + std::ostream& operator <<(std::ostream& o, IntegratorFactory& factory); }//namespace oopse #endif //INTEGRATORS_INTEGRATORFACTORY_HPP