xref: /openbmc/phosphor-logging/elog_meta.cpp (revision 50d5d260)
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>(
18     const std::string& match,
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 
46 #endif
47 
48 } // namespace associations
49 } // namespace metadata
50 } // namespace logging
51 } // namespace phosphor
52