| 480 | |
| 481 | |
| 482 | Root::Root(const PM_INTROSPECTION_ROOT* pRoot_, std::function<void(const PM_INTROSPECTION_ROOT*)> deleter_) |
| 483 | : |
| 484 | pRoot{ pRoot_ }, |
| 485 | deleter{ std::move(deleter_) } |
| 486 | { |
| 487 | assert(pRoot); |
| 488 | assert(deleter); |
| 489 | // building lookup tables for enum/key |
| 490 | for (auto e : GetEnums()) { |
| 491 | for (auto k : e.GetKeys()) { |
| 492 | enumKeyMap[MakeEnumKeyMapKey_(e.GetId(), k.GetId())] = k.GetBasePtr(); |
| 493 | } |
| 494 | enumMap[e.GetId()] = e.GetBasePtr(); |
| 495 | } |
| 496 | // building lookup table for devices |
| 497 | for (auto d : GetDevices()) { |
| 498 | deviceMap[d.GetId()] = d.GetBasePtr(); |
| 499 | } |
| 500 | // building lookup table for metrics |
| 501 | for (auto m : GetMetrics()) { |
| 502 | metricMap[m.GetId()] = m.GetBasePtr(); |
| 503 | } |
| 504 | // building lookup table for units |
| 505 | for (auto u : GetUnits()) { |
| 506 | unitMap[u.GetId()] = u.GetBasePtr(); |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | Root::~Root() |
| 511 | { |
nothing calls this directly
no test coverage detected