| Cantera 3.0.0

Loading...
Searching...
No Matches
ExtensionManagerFactory.h
Go to the documentation of this file.
1//! @file ExtensionManagerFactory.h
2
3#ifndef CT_EXTENSIONMANAGERFACTORY_H
4#define CT_EXTENSIONMANAGERFACTORY_H
5
6// This file is part of Cantera. See License.txt in the top-level directory or
7// at https://cantera.org/license.txt for license and copyright information.
8
9#include "FactoryBase.h"
10#include "ExtensionManager.h"
11
12 namespace Cantera
13{
14
15//! A factory class for creating ExtensionManager objects
16//!
17//! @since New in %Cantera 3.0
18 class ExtensionManagerFactory : public Factory<ExtensionManager>
19{
20 public:
21 //! Create a new ExtensionManager
22 static shared_ptr<ExtensionManager> build(const string& extensionType) {
23 return shared_ptr<ExtensionManager>(factory().create(extensionType));
24 }
25
26 //! Delete the static instance of this factory
27 void deleteFactory() override;
28
29 //! Static function that returns the static instance of the factory, creating it
30 //! if necessary.
31 static ExtensionManagerFactory& factory();
32
33 private:
34 //! static member of the single factory instance
35 static ExtensionManagerFactory* s_factory;
36
37 //! Private constructor prevents direct usage
38 ExtensionManagerFactory() = default;
39
40 //! Decl for locking mutex for thermo factory singleton
41 static std::mutex s_mutex;
42};
43
44}
45
46#endif
ExtensionManager.h
FactoryBase.h
File contains the FactoryBase class declarations.
Cantera::ExtensionManagerFactory
A factory class for creating ExtensionManager objects.
Definition ExtensionManagerFactory.h:19
Cantera::ExtensionManagerFactory::s_factory
static ExtensionManagerFactory * s_factory
static member of the single factory instance
Definition ExtensionManagerFactory.h:35
Cantera::ExtensionManagerFactory::deleteFactory
void deleteFactory() override
Delete the static instance of this factory.
Definition ExtensionManagerFactory.cpp:25
Cantera::ExtensionManagerFactory::build
static shared_ptr< ExtensionManager > build(const string &extensionType)
Create a new ExtensionManager.
Definition ExtensionManagerFactory.h:22
Cantera::ExtensionManagerFactory::factory
static ExtensionManagerFactory & factory()
Static function that returns the static instance of the factory, creating it if necessary.
Definition ExtensionManagerFactory.cpp:16
Cantera::ExtensionManagerFactory::ExtensionManagerFactory
ExtensionManagerFactory()=default
Private constructor prevents direct usage.
Cantera::ExtensionManagerFactory::s_mutex
static std::mutex s_mutex
Decl for locking mutex for thermo factory singleton.
Definition ExtensionManagerFactory.h:41
Cantera::Factory
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Cantera::Factory< ExtensionManager >::create
ExtensionManager * create(const string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
Definition FactoryBase.h:75
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564