| Cantera 3.0.0

Loading...
Searching...
No Matches
FlowDeviceFactory.h
Go to the documentation of this file.
1//! @file FlowDeviceFactory.h
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#ifndef FLOWDEVICE_FACTORY_H
7#define FLOWDEVICE_FACTORY_H
8
9#include "cantera/base/FactoryBase.h"
10#include "cantera/zeroD/FlowDevice.h"
11
12 namespace Cantera
13{
14
15//! Factory class to create FlowDevice objects.
16//!
17//! This class is mainly used via the newFlowDevice3() function, for example:
18//!
19//! ```cpp
20//! shared_ptr<FlowDevice> mfc = newFlowDevice3("MassFlowController");
21//! ```
22 class FlowDeviceFactory : public Factory<FlowDevice>
23{
24 public:
25 static FlowDeviceFactory* factory();
26
27 void deleteFactory() override;
28
29 //! Create a new flow device by type name.
30 /*!
31 * @param flowDeviceType the type to be created.
32 * @deprecated To be removed after %Cantera 3.0; replaceable by newFlowDevice3.
33 */
34 FlowDevice* newFlowDevice(const string& flowDeviceType);
35
36 private:
37 static FlowDeviceFactory* s_factory;
38 static std::mutex flowDevice_mutex;
39 FlowDeviceFactory();
40};
41
42//! @defgroup flowDeviceGroup Flow Devices
43//! Flow device objects connect zero-dimensional reactors.
44//! FlowDevice objects should be instantiated via the newFlowDevice3() function, for
45//! example:
46//!
47//! ```cpp
48//! shared_ptr<FlowDevice> mfc = newFlowDevice3("MassFlowController");
49//! ```
50//! @ingroup zerodGroup
51//! @{
52
53//! Create a FlowDevice object of the specified type
54//! @deprecated To be changed after %Cantera 3.0; for new behavior, see
55//! newFlowDevice3().
56 FlowDevice* newFlowDevice(const string& model);
57
58//! Create a FlowDevice object of the specified type
59//! @since New in %Cantera 3.0.
60//! @todo Transition back to newFlowDevice() after %Cantera 3.0
61 shared_ptr<FlowDevice> newFlowDevice3(const string& model);
62
63//! @}
64}
65
66#endif
FactoryBase.h
File contains the FactoryBase class declarations.
FlowDevice.h
Cantera::Factory
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Cantera::FlowDeviceFactory
Factory class to create FlowDevice objects.
Definition FlowDeviceFactory.h:23
Cantera::FlowDeviceFactory::newFlowDevice
FlowDevice * newFlowDevice(const string &flowDeviceType)
Create a new flow device by type name.
Definition FlowDeviceFactory.cpp:37
Cantera::FlowDeviceFactory::deleteFactory
void deleteFactory() override
Virtual abstract function that deletes the factory.
Definition FlowDeviceFactory.cpp:30
Cantera::FlowDevice
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition FlowDevice.h:24
Cantera::newFlowDevice
FlowDevice * newFlowDevice(const string &model)
Create a FlowDevice object of the specified type.
Definition FlowDeviceFactory.cpp:44
Cantera::newFlowDevice3
shared_ptr< FlowDevice > newFlowDevice3(const string &model)
Create a FlowDevice object of the specified type.
Definition FlowDeviceFactory.cpp:51
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564