Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 1 | #include "config.h" |
| 2 | #include "elog_meta.hpp" |
| 3 | |
| 4 | namespace phosphor |
| 5 | { |
| 6 | namespace logging |
| 7 | { |
| 8 | namespace metadata |
| 9 | { |
| 10 | namespace associations |
| 11 | { |
| 12 | |
| 13 | #if defined PROCESS_META |
| 14 | |
| 15 | template <> |
| 16 | void build<xyz::openbmc_project::Common:: |
| 17 | Callout::Device::CALLOUT_DEVICE_PATH>( |
Deepak Kodihalli | a5d8d15 | 2017-03-16 05:10:05 -0500 | [diff] [blame] | 18 | const std::string& match, |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 19 | const std::vector<std::string>& data, |
| 20 | AssociationList& list) |
| 21 | { |
| 22 | std::map<std::string, std::string> metadata; |
| 23 | parse(data, metadata); |
| 24 | auto iter = metadata.find(match); |
| 25 | if(metadata.end() != iter) |
| 26 | { |
| 27 | auto comp = [](const auto& first, const auto& second) |
| 28 | { |
| 29 | return (strcmp(std::get<0>(first), second) < 0); |
| 30 | }; |
| 31 | auto callout = std::lower_bound(callouts.begin(), |
| 32 | callouts.end(), |
| 33 | (iter->second).c_str(), |
| 34 | comp); |
| 35 | if((callouts.end() != callout) && |
| 36 | !strcmp((iter->second).c_str(), std::get<0>(*callout))) |
| 37 | { |
| 38 | list.emplace_back(std::make_tuple(CALLOUT_FWD_ASSOCIATION, |
| 39 | CALLOUT_REV_ASSOCIATION, |
| 40 | std::string(INVENTORY_ROOT) + |
| 41 | std::get<1>(*callout))); |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
Tom Joseph | 213aaf6 | 2017-07-25 00:02:09 +0530 | [diff] [blame] | 46 | template <> |
| 47 | void build<xyz::openbmc_project::Common:: |
| 48 | Callout::Inventory::CALLOUT_INVENTORY_PATH>( |
| 49 | const std::string& match, |
| 50 | const std::vector<std::string>& data, |
| 51 | AssociationList& list) |
| 52 | { |
| 53 | std::map<std::string, std::string> metadata; |
| 54 | parse(data, metadata); |
| 55 | auto iter = metadata.find(match); |
| 56 | if (metadata.end() != iter) |
| 57 | { |
| 58 | list.emplace_back(std::make_tuple(CALLOUT_FWD_ASSOCIATION, |
| 59 | CALLOUT_REV_ASSOCIATION, |
| 60 | std::string(iter->second.c_str()))); |
| 61 | } |
| 62 | } |
| 63 | |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 64 | #endif |
| 65 | |
| 66 | } // namespace associations |
| 67 | } // namespace metadata |
| 68 | } // namespace logging |
| 69 | } // namespace phosphor |