12FlowDeviceFactory* FlowDeviceFactory::s_factory = 0;
13std::mutex FlowDeviceFactory::flowDevice_mutex;
15FlowDeviceFactory::FlowDeviceFactory()
17 reg(
"MassFlowController", [](
const string& name) {
18 return new MassFlowController(name);
20 reg(
"PressureController", [](
const string& name) {
21 return new PressureController(name);
23 reg(
"Valve", [](
const string& name) {
24 return new Valve(name);
28FlowDeviceFactory* FlowDeviceFactory::factory() {
29 std::unique_lock<std::mutex> lock(flowDevice_mutex);
31 s_factory =
new FlowDeviceFactory;
37 std::unique_lock<std::mutex> lock(flowDevice_mutex);
42shared_ptr<FlowDevice>
newFlowDevice(
const string& model,
const string& name)
44 return shared_ptr<FlowDevice>(FlowDeviceFactory::factory()->create(model, name));
50 "Use newFlowDevice instead; to be removed after Cantera 3.1.");
void reg(const string &name, function< FlowDevice *(Args...)> f)
Register a new object construction function.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Some flow devices derived from class FlowDevice.
shared_ptr< FlowDevice > newFlowDevice(const string &model, const string &name)
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.