Cantera  2.4.0
PDSSFactory.h
Go to the documentation of this file.
1 //! @file PDSSFactory.h
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 #ifndef PDSS_FACTORY_H
7 #define PDSS_FACTORY_H
8 
9 #include "PDSS.h"
12 
13 namespace Cantera
14 {
15 
16 class PDSSFactory : public Factory<PDSS>
17 {
18 public:
19  //! Static function that creates a static instance of the factory.
20  static PDSSFactory* factory() {
21  std::unique_lock<std::mutex> lock(thermo_mutex);
22  if (!s_factory) {
23  s_factory = new PDSSFactory;
24  }
25  return s_factory;
26  }
27 
28  //! delete the static instance of this factory
29  virtual void deleteFactory() {
30  std::unique_lock<std::mutex> lock(thermo_mutex);
31  delete s_factory;
32  s_factory = 0;
33  }
34 
35  //! Create a new thermodynamic property manager.
36  /*!
37  * @param model String to look up the model against
38  * @returns a pointer to a new PDSS instance matching the model string.
39  * Returns NULL if something went wrong. Throws an exception if the string
40  * wasn't matched.
41  */
42  virtual PDSS* newPDSS(const std::string& model);
43 
44 private:
45  //! static member of a single instance
46  static PDSSFactory* s_factory;
47 
48  //! Private constructors prevents usage
49  PDSSFactory();
50 
51  //! Decl for locking mutex for thermo factory singleton
52  static std::mutex thermo_mutex;
53 };
54 
55 PDSS* newPDSS(const std::string& model);
56 
57 }
58 
59 #endif
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
File contains the FactoryBase class declarations.