Cantera 2.6.0
FlowDeviceFactory.cpp
Go to the documentation of this file.
1//! @file FlowDeviceFactory.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
8
9using namespace std;
10namespace Cantera
11{
12
13FlowDeviceFactory* FlowDeviceFactory::s_factory = 0;
14std::mutex FlowDeviceFactory::flowDevice_mutex;
15
16FlowDeviceFactory::FlowDeviceFactory()
17{
18 reg("MassFlowController", []() { return new MassFlowController(); });
19 reg("PressureController", []() { return new PressureController(); });
20 reg("Valve", []() { return new Valve(); });
21}
22
23FlowDevice* FlowDeviceFactory::newFlowDevice(const std::string& flowDeviceType)
24{
25 return create(flowDeviceType);
26}
27
28}
FlowDevice * create(const std::string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
Definition: FactoryBase.h:76
void reg(const std::string &name, std::function< FlowDevice *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:81
virtual FlowDevice * newFlowDevice(const std::string &flowDeviceType)
Create a new flow device by type name.
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition: FlowDevice.h:24
Some flow devices derived from class FlowDevice.
Namespace for the Cantera kernel.
Definition: AnyMap.h:29