Cantera  3.1.0a1
DomainFactory Class Reference

Factory class to create domain objects. More...

#include <DomainFactory.h>

Inheritance diagram for DomainFactory:
[legend]

Detailed Description

Factory class to create domain objects.

This class is mainly used via the newDomain() function, for example:

shared_ptr<Domain1D> d1 = newDomain("Inlet", sol, "reactants");
shared_ptr< T > newDomain(const string &domainType, shared_ptr< Solution > solution, const string &id="")
Create a Domain object of the specified type.
Definition: DomainFactory.h:53

Definition at line 22 of file DomainFactory.h.

Public Member Functions

void deleteFactory () override
 Virtual abstract function that deletes the factory. More...
 
- Public Member Functions inherited from Factory< Domain1D, shared_ptr< Solution >, const string & >
Domain1Dcreate (const string &name, Args... args)
 Create an object using the object construction function corresponding to "name" and the provided constructor arguments. More...
 
void reg (const string &name, function< Domain1D *(Args...)> f)
 Register a new object construction function. More...
 
void addAlias (const string &original, const string &alias)
 Add an alias for an existing registered type. More...
 
string canonicalize (const string &name)
 Get the canonical name registered for a type. More...
 
bool exists (const string &name) const
 Returns true if name is registered with this factory. More...
 
- Public Member Functions inherited from FactoryBase
virtual ~FactoryBase ()
 destructor More...
 

Static Public Member Functions

static DomainFactoryfactory ()
 Return a pointer to the factory. More...
 
- Static Public Member Functions inherited from FactoryBase
static void deleteFactories ()
 static function that deletes all factories in the internal registry maintained in a static variable More...
 

Private Member Functions

 DomainFactory ()
 default constructor, which is defined as private More...
 

Static Private Attributes

static DomainFactorys_factory = 0
 Pointer to the single instance of the factory. More...
 
static std::mutex domain_mutex
 Mutex for use when calling the factory. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Factory< Domain1D, shared_ptr< Solution >, const string & >
void addDeprecatedAlias (const string &original, const string &alias)
 Add a deprecated alias for an existing registered type. More...
 
- Protected Member Functions inherited from FactoryBase
 FactoryBase ()
 Constructor. More...
 

Constructor & Destructor Documentation

◆ DomainFactory()

DomainFactory ( )
private

default constructor, which is defined as private

Definition at line 18 of file DomainFactory.cpp.

Member Function Documentation

◆ factory()

DomainFactory * factory ( )
static

Return a pointer to the factory.

On the first call, a new instance is created. Since there is no need to instantiate more than one factory, on all subsequent calls, a pointer to the existing factory is returned.

Definition at line 79 of file DomainFactory.cpp.

◆ deleteFactory()

void deleteFactory ( )
overridevirtual

Virtual abstract function that deletes the factory.

This must be properly defined in child objects.

Implements FactoryBase.

Definition at line 88 of file DomainFactory.cpp.

Member Data Documentation

◆ s_factory

DomainFactory * s_factory = 0
staticprivate

Pointer to the single instance of the factory.

Definition at line 36 of file DomainFactory.h.

◆ domain_mutex

std::mutex domain_mutex
staticprivate

Mutex for use when calling the factory.

Definition at line 42 of file DomainFactory.h.


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