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

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

#include <HydrodynamicsModelFactory.hpp>

Public Types

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

Public Member Functions

bool registerHydrodynamicsModel (HydrodynamicsModelCreator *creator)
 Registers a creator with a type identifier.
 
bool unregisterHydrodynamicsModel (const std::string &id)
 Unregisters the creator for the given type identifier.
 
HydrodynamicsModelcreateHydrodynamicsModel (const std::string &id)
 Looks up the type identifier in the internal map.
 
IdentVectorType getIdents ()
 Returns all of the registed type identifiers.
 

Static Public Member Functions

static HydrodynamicsModelFactorygetInstance ()
 Returns an instance of HydrodynamicsModel factory.
 

Detailed Description

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

Definition at line 72 of file HydrodynamicsModelFactory.hpp.

Member Typedef Documentation

◆ CreatorMapType

using OpenMD::HydrodynamicsModelFactory::CreatorMapType = std::map<std::string, HydrodynamicsModelCreator*>

Definition at line 74 of file HydrodynamicsModelFactory.hpp.

◆ IdentVectorIterator

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

Definition at line 76 of file HydrodynamicsModelFactory.hpp.

◆ IdentVectorType

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

Definition at line 75 of file HydrodynamicsModelFactory.hpp.

Constructor & Destructor Documentation

◆ ~HydrodynamicsModelFactory()

OpenMD::HydrodynamicsModelFactory::~HydrodynamicsModelFactory ( )

Definition at line 57 of file HydrodynamicsModelFactory.cpp.

Member Function Documentation

◆ createHydrodynamicsModel()

HydrodynamicsModel * OpenMD::HydrodynamicsModelFactory::createHydrodynamicsModel ( const std::string & id)

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
sda pointer to the StuntDouble being modeled
infoa pointer to the SimInfo object

Definition at line 73 of file HydrodynamicsModelFactory.cpp.

◆ getIdents()

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

Returns all of the registed type identifiers.

Returns
all of the registed type identifiers

Definition at line 84 of file HydrodynamicsModelFactory.cpp.

Referenced by OpenMD::operator<<().

◆ getInstance()

static HydrodynamicsModelFactory * OpenMD::HydrodynamicsModelFactory::getInstance ( )
inlinestatic

Returns an instance of HydrodynamicsModel factory.

Returns
an instance of HydrodynamicsModel factory

Definition at line 84 of file HydrodynamicsModelFactory.hpp.

◆ registerHydrodynamicsModel()

bool OpenMD::HydrodynamicsModelFactory::registerHydrodynamicsModel ( HydrodynamicsModelCreator * creator)

Registers a creator with a type identifier.

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

Definition at line 61 of file HydrodynamicsModelFactory.cpp.

◆ unregisterHydrodynamicsModel()

bool OpenMD::HydrodynamicsModelFactory::unregisterHydrodynamicsModel ( 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 68 of file HydrodynamicsModelFactory.cpp.


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