Cantera  3.1.0a1
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.
32 
33 private:
34  //! static member of the single factory instance
36 
37  //! Private constructor prevents direct usage
39 
40  //! Decl for locking mutex for thermo factory singleton
41  static std::mutex s_mutex;
42 };
43 
44 }
45 
46 #endif
File contains the FactoryBase class declarations.
A factory class for creating ExtensionManager objects.
static ExtensionManagerFactory * s_factory
static member of the single factory instance
void deleteFactory() override
Delete the static instance of this factory.
static ExtensionManagerFactory & factory()
Static function that returns the static instance of the factory, creating it if necessary.
ExtensionManagerFactory()=default
Private constructor prevents direct usage.
static std::mutex s_mutex
Decl for locking mutex for thermo factory singleton.
static shared_ptr< ExtensionManager > build(const string &extensionType)
Create a new ExtensionManager.
Factory class that supports registering functions to create objects.
Definition: FactoryBase.h:69
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
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564