ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/integrators/IntegratorFactory.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/integrators/IntegratorFactory.hpp (file contents):
Revision 1836 by tim, Thu Dec 2 03:12:25 2004 UTC vs.
Revision 1837 by tim, Thu Dec 2 22:15:31 2004 UTC

# Line 32 | Line 32
32   #ifndef INTEGRATORS_INTEGRATORFACTORY_HPP
33   #define INTEGRATORS_INTEGRATORFACTORY_HPP
34   #include <cassert>
35 #include <iostream>
35   #include <map>
36   #include <string>
37   #include <vector>
38 <
38 > #include <iostream>
39   namespace oopse {
40  
41   //forward declaration
42   class Integrator;
43 + class IntegratorCreator;
44   class SimInfo;
45   /**
46 < * @class IntegratorFactory IntegratorFactory.hpp "integrators/IntegratorFactory.hpp"
46 > * @class IntegratorFactory IntegratorFactory.hpp "UseTheForce/IntegratorFactory.hpp"
47   * Factory pattern and Singleton Pattern are used to define an interface for creating an Integrator.
48 * @note we can actually use GenericFactory
48   */
49   class IntegratorFactory {
50      public:
51 <
52 <        /** a function pointer which has not parameter and return a pointer pointer to a Integrator instance*/
54 <        typedef Integrator* (*IntegratorCreatorType)(SimInfo*);        
55 <        
56 <        typedef std::map<std::string, IntegratorCreatorType> CreatorMapType;
51 >                
52 >        typedef std::map<std::string, IntegratorCreator*> CreatorMapType;
53          typedef std::vector<std::string> IdentVectorType;
54          typedef std::vector<std::string>::iterator IdentVectorIterator;
55                      
# Line 62 | Line 58 | class IntegratorFactory {
58           * @return an instance of Integrator factory
59           */        
60          static IntegratorFactory* getInstance() {
61 +
62              if (instance_ == NULL) {
63                  instance_ = new IntegratorFactory();
64              }
65              return instance_;
66 +            
67          }
68  
69          /**
# Line 74 | Line 72 | class IntegratorFactory {
72           * @id the identification of the concrete object
73           * @creator the object responsible to create the concrete object
74           */
75 <        bool registerIntegrator(const std::string& id, IntegratorCreatorType creator);
75 >        bool registerIntegrator(IntegratorCreator* creator);
76  
77          /**
78           * Unregisters the creator for the given type identifier. If the type identifier
# Line 109 | Line 107 | std::ostream& operator <<(std::ostream& o, IntegratorF
107  
108   }//namespace oopse
109   #endif //INTEGRATORS_INTEGRATORFACTORY_HPP
110 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines