--- trunk/tengDissertation/Appendix.tex 2006/06/08 20:24:39 2829 +++ trunk/tengDissertation/Appendix.tex 2006/06/08 21:02:53 2831 @@ -179,36 +179,25 @@ class IntegratorFactory { public: typedef std::map CreatorMapType; - bool registerIntegrator(IntegratorCreator* creator); + bool registerIntegrator(IntegratorCreator* creator) { + return creatorMap_.insert(creator->getIdent(), creator).second; + } - Integrator* createIntegrator(const string& id, SimInfo* info); + Integrator* createIntegrator(const string& id, SimInfo* info) { + Integrator* result = NULL; + CreatorMapType::iterator i = creatorMap_.find(id); + if (i != creatorMap_.end()) { + result = (i->second)->create(info); + } + return result; + } private: CreatorMapType creatorMap_; }; - \end{lstlisting} - -\begin{lstlisting}[float,caption={[The implementation of Factory pattern (II)].},label={appendixScheme:factoryDeclarationImplementation}] - -bool IntegratorFactory::unregisterIntegrator(const string& id) { - return creatorMap_.erase(id) == 1; -} - -Integrator* IntegratorFactory::createIntegrator(const string& id, - SimInfo* info) { - CreatorMapType::iterator i = creatorMap_.find(id); - if (i != creatorMap_.end()) { - return (i->second)->create(info); - } else { - return NULL; - } -} +\begin{lstlisting}[float,caption={[The implementation of Factory pattern (III)]Souce code of creator classes.},label={appendixScheme:integratorCreator}] -\end{lstlisting} - -\begin{lstlisting}[float,caption={[The implementation of Factory pattern (III)].},label={appendixScheme:integratorCreator}] - class IntegratorCreator { public: IntegratorCreator(const string& ident) : ident_(ident) {} @@ -308,8 +297,8 @@ body in a DMPC molecule is DMPC\_RB\_0. \begin{figure} \centering \includegraphics[width=\linewidth]{heirarchy.eps} -\caption[Class heirarchy for StuntDoubles in {\sc OOPSE}]{ The class -heirarchy of StuntDoubles in {\sc OOPSE}. +\caption[Class heirarchy for ojects in {\sc OOPSE}]{ A diagram of +the class heirarchy. \begin{itemize} \item A {\bf StuntDouble} is {\it any} object that can be manipulated by the integrators and minimizers.