| Cantera 3.0.0

Loading...
Searching...
No Matches
ExtensionManagerFactory.cpp
Go to the documentation of this file.
1//! @file ExtensionManagerFactory.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
6#include "cantera/base/ExtensionManagerFactory.h"
7
8 using namespace std;
9
10 namespace Cantera
11{
12
13ExtensionManagerFactory* ExtensionManagerFactory::s_factory = 0;
14mutex ExtensionManagerFactory::s_mutex;
15
16 ExtensionManagerFactory& ExtensionManagerFactory::factory()
17{
18 unique_lock<mutex> lock(s_mutex);
19 if (!s_factory) {
20 s_factory = new ExtensionManagerFactory();
21 }
22 return *s_factory;
23}
24
25 void ExtensionManagerFactory::deleteFactory()
26{
27 unique_lock<mutex> lock(s_mutex);
28 delete s_factory;
29 s_factory = 0;
30}
31
32}
ExtensionManagerFactory.h
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::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
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564