-
Notifications
You must be signed in to change notification settings - Fork 34
/
elog_meta.cpp
63 lines (56 loc) · 1.71 KB
/
elog_meta.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "config.h"
#include "elog_meta.hpp"
namespace phosphor
{
namespace logging
{
namespace metadata
{
namespace associations
{
#if defined PROCESS_META
template <>
void build<xyz::openbmc_project::common::callout::Device::CALLOUT_DEVICE_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
std::map<std::string, std::string> metadata;
parse(data, metadata);
auto iter = metadata.find(match);
if (metadata.end() != iter)
{
auto comp = [](const auto& first, const auto& second) {
return (std::strcmp(std::get<0>(first), second) < 0);
};
auto callout = std::lower_bound(callouts.begin(), callouts.end(),
(iter->second).c_str(), comp);
if ((callouts.end() != callout) &&
!std::strcmp((iter->second).c_str(), std::get<0>(*callout)))
{
list.emplace_back(std::make_tuple(
CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION,
std::string(INVENTORY_ROOT) + std::get<1>(*callout)));
}
}
}
template <>
void build<
xyz::openbmc_project::common::callout::Inventory::CALLOUT_INVENTORY_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
std::map<std::string, std::string> metadata;
parse(data, metadata);
auto iter = metadata.find(match);
if (metadata.end() != iter)
{
list.emplace_back(
std::make_tuple(CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION,
std::string(iter->second.c_str())));
}
}
#endif
} // namespace associations
} // namespace metadata
} // namespace logging
} // namespace phosphor