| 302 | DeviceMapperRegistryImpl() {} |
| 303 | |
| 304 | Status RegisterDevice(DeviceAllocationType device_type, DeviceMapper memory_mapper) { |
| 305 | std::lock_guard<std::mutex> lock(lock_); |
| 306 | auto [_, inserted] = registry_.try_emplace(device_type, std::move(memory_mapper)); |
| 307 | if (!inserted) { |
| 308 | return Status::KeyError("Device type ", static_cast<int>(device_type), |
| 309 | " is already registered"); |
| 310 | } |
| 311 | return Status::OK(); |
| 312 | } |
| 313 | |
| 314 | Result<DeviceMapper> GetMapper(DeviceAllocationType device_type) { |
| 315 | std::lock_guard<std::mutex> lock(lock_); |
no test coverage detected