12FlowDeviceFactory* FlowDeviceFactory::s_factory = 0;
13std::mutex FlowDeviceFactory::flowDevice_mutex;
15FlowDeviceFactory::FlowDeviceFactory()
17 reg(
"MassFlowController", []() {
return new MassFlowController(); });
18 reg(
"PressureController", []() {
return new PressureController(); });
19 reg(
"Valve", []() {
return new Valve(); });
22FlowDeviceFactory* FlowDeviceFactory::factory() {
23 std::unique_lock<std::mutex> lock(flowDevice_mutex);
25 s_factory =
new FlowDeviceFactory;
31 std::unique_lock<std::mutex> lock(flowDevice_mutex);
40 "To be removed after Cantera 3.0; for new behavior, see 'newFlowDevice3'.");
41 return create(flowDeviceType);
47 "To be changed after Cantera 3.0; for new behavior, see 'newFlowDevice3'.");
48 return FlowDeviceFactory::factory()->newFlowDevice(model);
53 shared_ptr<FlowDevice> fdptr(FlowDeviceFactory::factory()->create(model));
FlowDevice * create(const string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
void reg(const string &name, function< FlowDevice *(Args...)> f)
Register a new object construction function.
FlowDevice * newFlowDevice(const string &flowDeviceType)
Create a new flow device by type name.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Some flow devices derived from class FlowDevice.
FlowDevice * newFlowDevice(const string &model)
Create a FlowDevice object of the specified type.
shared_ptr< FlowDevice > newFlowDevice3(const string &model)
Create a FlowDevice object of the specified type.
Namespace for the Cantera kernel.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.