| 47 | } |
| 48 | |
| 49 | auto DeviceManager::FindDevice(const char* name) -> Expected<DeviceNode*> { |
| 50 | assert(name != nullptr && "FindDevice: name must not be null"); |
| 51 | LockGuard guard(lock_); |
| 52 | const auto it = name_index_.find(name); |
| 53 | if (it != name_index_.end()) { |
| 54 | return &devices_[it->second]; |
| 55 | } |
| 56 | return std::unexpected(Error(ErrorCode::kDeviceNotFound)); |
| 57 | } |
| 58 | |
| 59 | auto DeviceManager::FindDevicesByType(DeviceType type, DeviceNode** out, |
| 60 | size_t max) -> size_t { |