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 <chrono>
7 #include <string>
8 #include "count.hpp"
9 #include "data_types.hpp"
10 #include "journal.hpp"
11 #include "elog.hpp"
12 #include "errors.hpp"
13 #include "method.hpp"
14 #include "propertywatchimpl.hpp"
15 #include "pathwatchimpl.hpp"
16 #include "resolve_errors.hpp"
17 #include "sdbusplus.hpp"
18 #include "event.hpp"
19 #include "snmp_trap.hpp"
20 
21 using namespace std::string_literals;
22 using namespace std::chrono_literals;
23 
24 namespace phosphor
25 {
26 namespace dbus
27 {
28 namespace monitoring
29 {
30 
31 struct ConfigMeta
32 {
33     using Meta = std::array<std::string, ${len(meta)}>;
34 
35     static auto& get()
36     {
37         static const Meta meta =
38         {
39 % for m in meta:
40             "${m.name}"s,
41 % endfor
42         };
43         return meta;
44     }
45 };
46 
47 struct ConfigPaths
48 {
49     using Paths = std::array<std::string, ${len(paths)}>;
50 
51     static auto& get()
52     {
53         static const Paths paths =
54         {
55 % for p in paths:
56             "${p.name}"s,
57 % endfor
58         };
59         return paths;
60     }
61 };
62 
63 struct ConfigInterfaces
64 {
65     using Interfaces = std::array<std::string, ${len(interfaces)}>;
66 
67     static auto& get()
68     {
69         static const Interfaces interfaces =
70         {
71 % for i in interfaces:
72             "${i.name}"s,
73 % endfor
74         };
75         return interfaces;
76     }
77 };
78 
79 struct ConfigIntfAddPaths
80 {
81     using Paths = std::array<std::string, ${len(pathinstances)}>;
82 
83     static auto& get()
84     {
85         static const Paths paths =
86         {
87 % for p in pathinstances:
88             "${p.path}"s,
89 % endfor
90         };
91         return paths;
92     }
93 };
94 
95 struct ConfigProperties
96 {
97     using Properties = std::array<std::string, ${len(propertynames)}>;
98 
99     static auto& get()
100     {
101         static const Properties properties =
102         {
103 % for p in propertynames:
104             "${p.name}"s,
105 % endfor
106         };
107         return properties;
108     }
109 };
110 
111 struct ConfigPropertyStorage
112 {
113     using Storage = std::array<std::tuple<any_ns::any, any_ns::any>, ${len(instances)}>;
114 
115     static auto& get()
116     {
117         static Storage storage;
118         return storage;
119     }
120 };
121 
122 struct ConfigPropertyIndicies
123 {
124     using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
125 
126     static auto& get()
127     {
128         static const PropertyIndicies propertyIndicies =
129         {
130             {
131 % for g in instancegroups:
132                 {
133     % for i in g.members:
134                     {
135                         PropertyIndex::key_type
136                         {
137                             ConfigPaths::get()[${i[0]}],
138                             ConfigInterfaces::get()[${i[2]}],
139                             ConfigProperties::get()[${i[3]}]
140                         },
141                         PropertyIndex::mapped_type
142                         {
143                             ConfigMeta::get()[${i[1]}],
144                             ConfigMeta::get()[${i[4]}],
145                             ConfigPropertyStorage::get()[${i[5]}]
146                         },
147                     },
148     % endfor
149                 },
150 % endfor
151             }
152         };
153         return propertyIndicies;
154     }
155 };
156 
157 struct ConfigPropertyCallbackGroups
158 {
159     using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
160     static auto& get()
161     {
162         static const CallbackGroups propertyCallbackGraph =
163         {
164             {
165 % for g in callbackgroups:
166                 {${', '.join([str(x) for x in g.members])}},
167 % endfor
168             }
169         };
170         return propertyCallbackGraph;
171     }
172 };
173 
174 struct ConfigConditions
175 {
176     using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
177 
178     static auto& get()
179     {
180         static const Conditions propertyConditions =
181         {
182 % for c in conditions:
183             ${c.construct(loader, indent=indent +3)},
184 % endfor
185         };
186         return propertyConditions;
187     }
188 };
189 
190 struct ConfigPropertyCallbacks
191 {
192     using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
193 
194     static auto& get()
195     {
196         static const Callbacks propertyCallbacks =
197         {
198 % for c in callbacks:
199             ${c.construct(loader, indent=indent +3)},
200 % endfor
201         };
202         return propertyCallbacks;
203     }
204 };
205 
206 struct ConfigPathCallbacks
207 {
208     using Callbacks = std::array<std::unique_ptr<Callback>, ${len(pathcallbacks)}>;
209 
210     static auto& get()
211     {
212         static const Callbacks pathCallbacks =
213         {
214 % for c in pathcallbacks:
215             ${c.construct(loader, indent=indent +3)},
216 % endfor
217         };
218         return pathCallbacks;
219     }
220 };
221 
222 struct ConfigPropertyWatches
223 {
224     using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
225 
226     static auto& get()
227     {
228         static const PropertyWatches propertyWatches =
229         {
230 % for w in watches:
231             std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
232     % if w.callback is None:
233                 ConfigPropertyIndicies::get()[${w.instances}]),
234     % else:
235                 ConfigPropertyIndicies::get()[${w.instances}],
236                 *ConfigPropertyCallbacks::get()[${w.callback}]),
237     % endif
238 % endfor
239         };
240         return propertyWatches;
241     }
242 };
243 
244 struct ConfigPathWatches
245 {
246     using PathWatches = std::array<std::unique_ptr<Watch>, ${len(pathwatches)}>;
247 
248     static auto& get()
249     {
250         static const PathWatches pathWatches =
251         {
252 % for w in pathwatches:
253             std::make_unique<PathWatch<SDBusPlus>>(
254     % if w.pathcallback is None:
255                 ConfigIntfAddPaths::get()[${w.pathinstances}]),
256     % else:
257                 ConfigIntfAddPaths::get()[${w.pathinstances}],
258                 *ConfigPathCallbacks::get()[${w.pathcallback}]),
259     % endif
260 % endfor
261         };
262         return pathWatches;
263     }
264 };
265 } // namespace monitoring
266 } // namespace dbus
267 } // namespace phosphor
268