blob: 5dfcab0ab806ef241062f67c2479f0b1b69c30e3 [file] [log] [blame]
Deepak Kodihalli682326a2017-03-06 05:26:53 -06001#include "config.h"
2#include "elog_meta.hpp"
3
4namespace phosphor
5{
6namespace logging
7{
8namespace metadata
9{
10namespace associations
11{
12
13#if defined PROCESS_META
14
15template <>
16void build<xyz::openbmc_project::Common::
17 Callout::Device::CALLOUT_DEVICE_PATH>(
Deepak Kodihallia5d8d152017-03-16 05:10:05 -050018 const std::string& match,
Deepak Kodihalli682326a2017-03-06 05:26:53 -060019 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