OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::IntegratorFactory Class Reference

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

#include <IntegratorFactory.hpp>

Public Types

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

Public Member Functions

bool registerIntegrator (IntegratorCreator *creator)
 Registers a creator with a type identifier.
 
bool unregisterIntegrator (const std::string &id)
 Unregisters the creator for the given type identifier.
 
IntegratorcreateIntegrator (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 IntegratorFactorygetInstance ()
 Returns an instance of Integrator factory.
 

Detailed Description

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

Definition at line 72 of file IntegratorFactory.hpp.

Member Typedef Documentation

◆ CreatorMapType

using OpenMD::IntegratorFactory::CreatorMapType = std::map<std::string, IntegratorCreator*>

Definition at line 74 of file IntegratorFactory.hpp.

◆ IdentVectorIterator

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

Definition at line 76 of file IntegratorFactory.hpp.

◆ IdentVectorType

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

Definition at line 75 of file IntegratorFactory.hpp.

Member Function Documentation

◆ createIntegrator()

Integrator * OpenMD::IntegratorFactory::createIntegrator ( 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 string of the concrete object
infopointer to the concrete SimInfo object

Definition at line 66 of file IntegratorFactory.cpp.

◆ getIdents()

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

Returns all of the registed type identifiers.

Returns
all of the registed type identifiers

Definition at line 77 of file IntegratorFactory.cpp.

Referenced by OpenMD::operator<<().

◆ getInstance()

static IntegratorFactory & OpenMD::IntegratorFactory::getInstance ( )
inlinestatic

Returns an instance of Integrator factory.

Returns
an instance of Integrator factory

Definition at line 83 of file IntegratorFactory.hpp.

Referenced by OpenMD::registerIntegrators().

◆ registerIntegrator()

bool OpenMD::IntegratorFactory::registerIntegrator ( IntegratorCreator * creator)

Registers a creator with a type identifier.

Returns
true if registration is successful, otherwise return false
Parameters
creatorthe object responsible for creating the concrete object

Definition at line 56 of file IntegratorFactory.cpp.

◆ unregisterIntegrator()

bool OpenMD::IntegratorFactory::unregisterIntegrator ( 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 62 of file IntegratorFactory.cpp.


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