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);
38 return shared_ptr<FlowDevice>(FlowDeviceFactory::factory()->create(model));
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)
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.