40 |
|
|
41 |
|
//forward declaration |
42 |
|
class ForceField; |
43 |
< |
|
43 |
> |
class ForceFieldCreator; |
44 |
|
/** |
45 |
|
* @class ForceFieldFactory ForceFieldFactory.hpp "UseTheForce/ForceFieldFactory.hpp" |
46 |
|
* Factory pattern and Singleton Pattern are used to define an interface for creating an ForceField. |
47 |
|
*/ |
48 |
|
class ForceFieldFactory { |
49 |
|
public: |
50 |
< |
|
51 |
< |
/** a function pointer which has not parameter and return a pointer pointer to a ForceField instance*/ |
52 |
< |
typedef ForceField* (*ForceFieldCreatorType)(); |
53 |
< |
|
54 |
< |
typedef std::map<std::string, ForceFieldCreatorType> CreatorMapType; |
50 |
> |
|
51 |
> |
typedef std::map<std::string, ForceFieldCreator*> CreatorMapType; |
52 |
|
typedef std::vector<std::string> IdentVectorType; |
53 |
|
typedef std::vector<std::string>::iterator IdentVectorIterator; |
54 |
|
|
71 |
|
* @id the identification of the concrete object |
72 |
|
* @creator the object responsible to create the concrete object |
73 |
|
*/ |
74 |
< |
bool registerForceField(const std::string& id, ForceFieldCreatorType creator); |
74 |
> |
bool registerForceField(ForceFieldCreator* creator); |
75 |
|
|
76 |
|
/** |
77 |
|
* Unregisters the creator for the given type identifier. If the type identifier |