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
6#include "cantera/zeroD/FlowDeviceFactory.h"
7#include "cantera/zeroD/flowControllers.h"
8
9 using namespace std;
10 namespace 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
23 FlowDevice* FlowDeviceFactory::newFlowDevice(const std::string& flowDeviceType)
24{
25 return create(flowDeviceType);
26}
27
28}
FlowDeviceFactory.h
Cantera::Factory< FlowDevice >::create
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
Cantera::Factory< FlowDevice >::reg
void reg(const std::string &name, std::function< FlowDevice *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:81
Cantera::FlowDeviceFactory::newFlowDevice
virtual FlowDevice * newFlowDevice(const std::string &flowDeviceType)
Create a new flow device by type name.
Definition: FlowDeviceFactory.cpp:23
Cantera::FlowDevice
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition: FlowDevice.h:24
flowControllers.h
Some flow devices derived from class FlowDevice.
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557