OpenMD 3.2
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::OptimizationFactory Class Reference

Factory pattern and Singleton Pattern are used to define an interface for creating an Optimization. More...

#include <OptimizationFactory.hpp>

Public Types

using CreatorMapType = std::map<std::string, OptimizationCreator*>
using IdentVectorType = std::vector<std::string>
using IdentVectorIterator = std::vector<std::string>::iterator

Public Member Functions

bool registerOptimization (OptimizationCreator *creator)
 Registers a creator with a type identifier.
bool unregisterOptimization (const std::string &id)
 Unregisters the creator for the given type identifier.
QuantLib::OptimizationMethodcreateOptimization (const std::string &id, SimInfo *info)
 Looks up the type identifier in the internal map.
IdentVectorType getIdents ()
 Returns all of the registed type identifiers.

Static Public Member Functions

static OptimizationFactory & getInstance ()
 Returns an instance of Optimization factory.

Detailed Description

Factory pattern and Singleton Pattern are used to define an interface for creating an Optimization.

Definition at line 71 of file OptimizationFactory.hpp.

Member Typedef Documentation

◆ CreatorMapType

using OpenMD::OptimizationFactory::CreatorMapType = std::map<std::string, OptimizationCreator*>

Definition at line 73 of file OptimizationFactory.hpp.

◆ IdentVectorIterator

using OpenMD::OptimizationFactory::IdentVectorIterator = std::vector<std::string>::iterator

Definition at line 75 of file OptimizationFactory.hpp.

◆ IdentVectorType

using OpenMD::OptimizationFactory::IdentVectorType = std::vector<std::string>

Definition at line 74 of file OptimizationFactory.hpp.

Member Function Documentation

◆ createOptimization()

QuantLib::OptimizationMethod * OpenMD::OptimizationFactory::createOptimization ( const std::string & id,
SimInfo * info )

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.

Returns
a pointer of the concrete object, return NULL if no creator is registed for creating this concrete object
Parameters
idthe identification of the concrete object
infopointer to the SimInfo object

Definition at line 69 of file OptimizationFactory.cpp.

◆ getIdents()

std::vector< std::string > OpenMD::OptimizationFactory::getIdents ( )

Returns all of the registed type identifiers.

Returns
all of the registed type identifiers

Definition at line 80 of file OptimizationFactory.cpp.

Referenced by OpenMD::operator<<().

◆ getInstance()

OptimizationFactory & OpenMD::OptimizationFactory::getInstance ( )
inlinestatic

Returns an instance of Optimization factory.

Returns
an instance of Optimization factory

Definition at line 81 of file OptimizationFactory.hpp.

Referenced by OpenMD::registerOptimizers().

◆ registerOptimization()

bool OpenMD::OptimizationFactory::registerOptimization ( OptimizationCreator * creator)

Registers a creator with a type identifier.

Returns
true if registration is succeed, otherwise return false
Parameters
creatorthe object responsible to create the concrete object

Definition at line 59 of file OptimizationFactory.cpp.

Referenced by OpenMD::registerOptimizers().

◆ unregisterOptimization()

bool OpenMD::OptimizationFactory::unregisterOptimization ( const std::string & id)

Unregisters the creator for the given type identifier.

If the type identifier was previously registered, the function returns true.

Returns
truethe type identifier was previously registered and the creator is removed, otherwise return false
Parameters
idthe identification of the concrete object

Definition at line 65 of file OptimizationFactory.cpp.


The documentation for this class was generated from the following files: