1 ## This file is a template, the comment below is emitted into the generated file
2 /* This is an auto generated file. Do not edit. */
3 #pragma once
4 
5 #include <array>
6 #include <string>
7 #include "data_types.hpp"
8 #include "journal.hpp"
9 #include "propertywatchimpl.hpp"
10 #include "sdbusplus.hpp"
11 
12 using namespace std::string_literals;
13 
14 namespace phosphor
15 {
16 namespace dbus
17 {
18 namespace monitoring
19 {
20 
21 struct ConfigMeta
22 {
23     using Meta = std::array<std::string, ${len(meta)}>;
24 
25     static auto& get()
26     {
27         static const Meta meta =
28         {
29 % for m in meta:
30             "${m.name}"s,
31 % endfor
32         };
33         return meta;
34     }
35 };
36 
37 struct ConfigPaths
38 {
39     using Paths = std::array<std::string, ${len(paths)}>;
40 
41     static auto& get()
42     {
43         static const Paths paths =
44         {
45 % for p in paths:
46             "${p.name}"s,
47 % endfor
48         };
49         return paths;
50     }
51 };
52 
53 struct ConfigInterfaces
54 {
55     using Interfaces = std::array<std::string, ${len(interfaces)}>;
56 
57     static auto& get()
58     {
59         static const Interfaces interfaces =
60         {
61 % for i in interfaces:
62             "${i.name}"s,
63 % endfor
64         };
65         return interfaces;
66     }
67 };
68 
69 struct ConfigProperties
70 {
71     using Properties = std::array<std::string, ${len(propertynames)}>;
72 
73     static auto& get()
74     {
75         static const Properties properties =
76         {
77 % for p in propertynames:
78             "${p.name}"s,
79 % endfor
80         };
81         return properties;
82     }
83 };
84 
85 struct ConfigPropertyStorage
86 {
87     using Storage = std::array<any_ns::any, ${len(instances)}>;
88 
89     static auto& get()
90     {
91         static Storage storage;
92         return storage;
93     }
94 };
95 
96 struct ConfigPropertyIndicies
97 {
98     using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
99 
100     static auto& get()
101     {
102         static const PropertyIndicies propertyIndicies =
103         {
104             {
105 % for g in instancegroups:
106                 {
107     % for i in g.members:
108                     {
109                         PropertyIndex::key_type
110                         {
111                             std::cref(ConfigPaths::get()[${i[0]}]),
112                             std::cref(ConfigInterfaces::get()[${i[2]}]),
113                             std::cref(ConfigProperties::get()[${i[3]}])
114                         },
115                         PropertyIndex::mapped_type
116                         {
117                             std::cref(ConfigMeta::get()[${i[1]}]),
118                             std::cref(ConfigMeta::get()[${i[4]}]),
119                             std::ref(ConfigPropertyStorage::get()[${i[5]}])
120                         },
121                     },
122     % endfor
123                 },
124 % endfor
125             }
126         };
127         return propertyIndicies;
128     }
129 };
130 
131 struct ConfigPropertyCallbacks
132 {
133     using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
134 
135     static auto& get()
136     {
137         static const Callbacks propertyCallbacks =
138         {
139 % for c in callbacks:
140             ${c.construct(loader, indent=indent +3)},
141 % endfor
142         };
143         return propertyCallbacks;
144     }
145 };
146 
147 struct ConfigPropertyWatches
148 {
149     using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
150 
151     static auto& get()
152     {
153         static const PropertyWatches propertyWatches =
154         {
155 % for w in watches:
156             std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
157                 ConfigPropertyIndicies::get()[${w.instances}]),
158 % endfor
159         };
160         return propertyWatches;
161     }
162 };
163 } // namespace monitoring
164 } // namespace dbus
165 } // namespace phosphor
166