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 | |
| 5 | #include <phosphor-logging/elog-errors.hpp> |
| 6 | |
| 7 | using namespace sdbusplus::xyz::openbmc_project::Common::Error; |
| 8 | using namespace phosphor::logging; |
| 9 | |
| 10 | namespace pldm |
| 11 | { |
| 12 | namespace dbus_api |
| 13 | { |
| 14 | |
| 15 | uint8_t Requester::getInstanceId(uint8_t eid) |
| 16 | { |
| 17 | if (ids.find(eid) == ids.end()) |
| 18 | { |
| 19 | InstanceId id; |
| 20 | ids.emplace(eid, InstanceId()); |
| 21 | } |
| 22 | |
| 23 | uint8_t id{}; |
| 24 | try |
| 25 | { |
| 26 | id = ids[eid].next(); |
| 27 | } |
| 28 | catch (const std::runtime_error& e) |
| 29 | { |
| 30 | elog<TooManyResources>(); |
| 31 | } |
| 32 | |
| 33 | return id; |
| 34 | } |
| 35 | |
| 36 | } // namespace dbus_api |
| 37 | } // namespace pldm |