1 ## This file is a template.  The comment below is emitted
2 ## into the rendered file; feel free to edit this file.
3 // WARNING: Generated header. Do not edit!
4 
5 
6 #pragma once
7 
8 #include <map>
9 #include <iostream>
10 #include "defines.hpp"
11 #include "store.hpp"
12 #include "types.hpp"
13 #include "utils.hpp"
14 
15 namespace openpower
16 {
17 namespace vpd
18 {
19 namespace inventory
20 {
21 
22 /** @brief API to write parsed VPD to inventory,
23  *      for a specifc FRU
24  *
25  *  @param [in] vpdStore - Store object containing
26  *      parsed VPD
27  *  @param [in] path - FRU object path
28  */
29 template<Fru F>
30 void writeFru(const Store& vpdStore, const std::string& path);
31 
32 % for key in fruDict.iterkeys():
33 <%
34     fru = fruDict[key]
35 %>\
36 // Specialization of ${key}
37 template<>
38 void writeFru<Fru::${key}>(const Store& vpdStore,
39                            const std::string& path)
40 {
41     ObjectMap objects;
42     InterfaceMap interfaces;
43 
44     // Inventory manager needs object path, list of interface names to be
45     // implemented, and property:value pairs contained in said interfaces
46 
47     % for interface, properties in fru.iteritems():
48 <%
49         names = interface.split(".")
50         intfName = names[0] + names[-1]
51 %>\
52     PropertyMap ${intfName}Props;
53         % for name, value in properties.iteritems():
54             % if fru and interface and name and value:
55 <%
56                 record, keyword = value.split(",")
57 %>\
58     ${intfName}Props["${name}"] =
59         vpdStore.get<Record::${record}, record::Keyword::${keyword}>();
60             % endif
61         % endfor
62     interfaces.emplace("${interface}",
63                        std::move(${intfName}Props));
64     % endfor
65 
66     sdbusplus::message::object_path object(path);
67     objects.emplace(std::move(object), std::move(interfaces));
68 
69     callPIM(std::move(objects));
70 }
71 
72 % endfor
73 } // namespace inventory
74 } // namespace vpd
75 } // namespace openpower
76