Skip to content

Commit

Permalink
Add getter method to DeviceRegistry to obtain a vector of device keys
Browse files Browse the repository at this point in the history
  • Loading branch information
xela-95 committed Apr 9, 2024
1 parent 30cec04 commit 38587f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/device-registry/DeviceRegistry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ yarp::dev::PolyDriver* DeviceRegistry::getDevice(const std::string& deviceDataba
return tmp;
}

std::vector<std::string> DeviceRegistry::getDevicesKeys() const
{
std::vector<std::string> keys;
for (auto&& [key, value] : m_devicesMap)
keys.push_back(key);
return keys;
}

// Private methods

void DeviceRegistry::removeDevice(const std::string& deviceDatabaseKey)
{
DevicesMap::iterator device = m_devicesMap.find(deviceDatabaseKey);
Expand Down
2 changes: 2 additions & 0 deletions libraries/device-registry/DeviceRegistry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public:

void removeDevice(const std::string& deviceDatabaseKey);

std::vector<std::string> getDevicesKeys() const;

private:
DeviceRegistry();
static DeviceRegistry* s_handle;
Expand Down

0 comments on commit 38587f9

Please sign in to comment.