From 14635f49813df1699569d3b13456ea33955de54b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 13 Jan 2019 12:04:31 +0100 Subject: Add Device::create static method The method makes it easier to create a std::shared_ptr from a model enum instance. --- device.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'device.cc') diff --git a/device.cc b/device.cc index 58dc0e5..aabcbfc 100644 --- a/device.cc +++ b/device.cc @@ -209,6 +209,17 @@ std::vector Device::enumerate(){ return res; } +std::shared_ptr Device::create(DeviceModel model) { + switch (model) { + case DeviceModel::PRO: + return std::make_shared(); + case DeviceModel::STORAGE: + return std::make_shared(); + default: + return {}; + } +} + bool Device::could_be_enumerated() { LOG(__FUNCTION__, Loglevel::DEBUG_L2); std::lock_guard lock(mex_dev_com); -- cgit v1.2.1