Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 1 | #include "dbus_impl_requester.hpp" |
| 2 | |
| 3 | #include "xyz/openbmc_project/Common/error.hpp" |
| 4 | |
Sampa Misra | aa8ae72 | 2019-12-12 03:20:40 -0600 | [diff] [blame] | 5 | #include <iostream> |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 6 | |
| 7 | using namespace sdbusplus::xyz::openbmc_project::Common::Error; |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 8 | |
| 9 | namespace pldm |
| 10 | { |
| 11 | namespace dbus_api |
| 12 | { |
| 13 | |
| 14 | uint8_t Requester::getInstanceId(uint8_t eid) |
| 15 | { |
| 16 | if (ids.find(eid) == ids.end()) |
| 17 | { |
| 18 | InstanceId id; |
| 19 | ids.emplace(eid, InstanceId()); |
| 20 | } |
| 21 | |
| 22 | uint8_t id{}; |
| 23 | try |
| 24 | { |
| 25 | id = ids[eid].next(); |
| 26 | } |
| 27 | catch (const std::runtime_error& e) |
| 28 | { |
Sampa Misra | aa8ae72 | 2019-12-12 03:20:40 -0600 | [diff] [blame] | 29 | throw TooManyResources(); |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | return id; |
| 33 | } |
| 34 | |
| 35 | } // namespace dbus_api |
| 36 | } // namespace pldm |