mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
deviceregistry: add device_registered method.
This commit is contained in:
parent
4964008511
commit
f4c0499078
@ -29,7 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
bool DeviceRegistry::add(const std::string name, DeviceDescription desc)
|
||||
{
|
||||
if (get_registry().find(name) != get_registry().end()) {
|
||||
if (device_registered(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -37,7 +37,16 @@ bool DeviceRegistry::add(const std::string name, DeviceDescription desc)
|
||||
return true;
|
||||
}
|
||||
|
||||
shared_ptr<HWComponent> DeviceRegistry::create(const std::string& name)
|
||||
bool DeviceRegistry::device_registered(const string dev_name)
|
||||
{
|
||||
if (get_registry().find(dev_name) != get_registry().end()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unique_ptr<HWComponent> DeviceRegistry::create(const std::string& name)
|
||||
{
|
||||
auto it = get_registry().find(name);
|
||||
if (it != get_registry().end()) {
|
||||
|
@ -48,7 +48,9 @@ public:
|
||||
|
||||
static bool add(const string name, DeviceDescription desc);
|
||||
|
||||
static shared_ptr<HWComponent> create(const string& name);
|
||||
static bool device_registered(const string dev_name);
|
||||
|
||||
static unique_ptr<HWComponent> create(const string& name);
|
||||
|
||||
static DeviceDescription& get_descriptor(const std::string& name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user