blob: 9f9475a243c58252a44f8e98f2032d327c17cb5e [file] [log] [blame]
Brad Bishop870c3fc2017-05-22 23:23:13 -04001## 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
Brad Bishop05b0c1e2017-05-23 00:24:01 -04005#include <array>
Brad Bishop3539db62017-05-30 14:21:12 -04006#include <chrono>
Brad Bishop05b0c1e2017-05-23 00:24:01 -04007#include <string>
Brad Bishop4041d722017-05-21 10:06:07 -04008#include "count.hpp"
Matthew Barthefdd03c2019-09-04 15:44:35 -05009#include "median.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040010#include "data_types.hpp"
Brad Bishopc1283ae2017-05-20 21:42:38 -040011#include "journal.hpp"
Gunnar Millsd5faea32017-08-08 14:19:36 -050012#include "elog.hpp"
13#include "errors.hpp"
Brad Bishop0df00be2017-05-25 23:38:37 -040014#include "method.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040015#include "propertywatchimpl.hpp"
Marri Devender Rao80c70612018-04-12 09:22:55 -050016#include "pathwatchimpl.hpp"
Matt Spinler1d6ca482017-11-01 10:48:02 -050017#include "resolve_errors.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040018#include "sdbusplus.hpp"
Ratan Gupta90bfaea2017-10-06 20:56:31 +053019#include "event.hpp"
Marri Devender Rao80c70612018-04-12 09:22:55 -050020#include "snmp_trap.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040021
22using namespace std::string_literals;
Brad Bishop3539db62017-05-30 14:21:12 -040023using namespace std::chrono_literals;
Brad Bishop05b0c1e2017-05-23 00:24:01 -040024
Brad Bishop870c3fc2017-05-22 23:23:13 -040025namespace phosphor
26{
27namespace dbus
28{
29namespace monitoring
30{
31
Brad Bishop0e7df132017-05-23 17:58:12 -040032struct ConfigMeta
33{
34 using Meta = std::array<std::string, ${len(meta)}>;
35
36 static auto& get()
37 {
38 static const Meta meta =
39 {
40% for m in meta:
41 "${m.name}"s,
42% endfor
43 };
44 return meta;
45 }
46};
47
48struct ConfigPaths
49{
50 using Paths = std::array<std::string, ${len(paths)}>;
51
52 static auto& get()
53 {
54 static const Paths paths =
55 {
56% for p in paths:
57 "${p.name}"s,
58% endfor
59 };
60 return paths;
61 }
62};
Brad Bishope73b2c32017-05-23 18:01:54 -040063
64struct ConfigInterfaces
65{
66 using Interfaces = std::array<std::string, ${len(interfaces)}>;
67
68 static auto& get()
69 {
70 static const Interfaces interfaces =
71 {
72% for i in interfaces:
73 "${i.name}"s,
74% endfor
75 };
76 return interfaces;
77 }
78};
79
Marri Devender Rao80c70612018-04-12 09:22:55 -050080struct ConfigIntfAddPaths
81{
82 using Paths = std::array<std::string, ${len(pathinstances)}>;
83
84 static auto& get()
85 {
86 static const Paths paths =
87 {
88% for p in pathinstances:
89 "${p.path}"s,
90% endfor
91 };
92 return paths;
93 }
94};
95
Brad Bishope73b2c32017-05-23 18:01:54 -040096struct ConfigProperties
97{
98 using Properties = std::array<std::string, ${len(propertynames)}>;
99
100 static auto& get()
101 {
102 static const Properties properties =
103 {
104% for p in propertynames:
105 "${p.name}"s,
106% endfor
107 };
108 return properties;
109 }
110};
Brad Bishop4b916f12017-05-23 18:06:38 -0400111
112struct ConfigPropertyStorage
113{
Matt Spinlerabe43ab2018-02-19 13:34:43 -0600114 using Storage = std::array<std::tuple<any_ns::any, any_ns::any>, ${len(instances)}>;
Brad Bishop4b916f12017-05-23 18:06:38 -0400115
116 static auto& get()
117 {
118 static Storage storage;
119 return storage;
120 }
121};
122
Matthew Barthefe01582019-09-09 15:22:37 -0500123struct ConfigPropertyFilters
124{
125 using PropertyFilters = std::array<std::unique_ptr<Filters>, ${len(filters)}>;
126
127 static auto& get()
128 {
129 static const PropertyFilters propertyFilters =
130 {
131% for f in filters:
132 std::make_unique<OperandFilters<${f.datatype}>>(
133 std::vector<std::function<bool(${f.datatype})>>{
134 % for o in f.filters:
135 [](const auto& val){
136 return val ${o.op} ${o.argument(loader, indent=indent +1)};
137 },
138 % endfor
139 }
140 ),
141% endfor
142 };
143 return propertyFilters;
144 }
145};
146
Brad Bishop4b916f12017-05-23 18:06:38 -0400147struct ConfigPropertyIndicies
148{
149 using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
150
151 static auto& get()
152 {
153 static const PropertyIndicies propertyIndicies =
154 {
155 {
156% for g in instancegroups:
157 {
158 % for i in g.members:
159 {
160 PropertyIndex::key_type
161 {
Brad Bishop1ada93b2017-05-31 19:46:52 -0400162 ConfigPaths::get()[${i[0]}],
163 ConfigInterfaces::get()[${i[2]}],
164 ConfigProperties::get()[${i[3]}]
Brad Bishop4b916f12017-05-23 18:06:38 -0400165 },
166 PropertyIndex::mapped_type
167 {
Brad Bishop1ada93b2017-05-31 19:46:52 -0400168 ConfigMeta::get()[${i[1]}],
169 ConfigMeta::get()[${i[4]}],
170 ConfigPropertyStorage::get()[${i[5]}]
Brad Bishop4b916f12017-05-23 18:06:38 -0400171 },
172 },
173 % endfor
174 },
175% endfor
176 }
177 };
178 return propertyIndicies;
179 }
180};
181
Brad Bishop49e66172017-05-23 19:16:21 -0400182struct ConfigPropertyCallbackGroups
183{
184 using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
185 static auto& get()
186 {
187 static const CallbackGroups propertyCallbackGraph =
188 {
189 {
190% for g in callbackgroups:
191 {${', '.join([str(x) for x in g.members])}},
192% endfor
193 }
194 };
195 return propertyCallbackGraph;
196 }
197};
198
Brad Bishop4041d722017-05-21 10:06:07 -0400199struct ConfigConditions
200{
201 using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
202
203 static auto& get()
204 {
205 static const Conditions propertyConditions =
206 {
207% for c in conditions:
208 ${c.construct(loader, indent=indent +3)},
209% endfor
210 };
211 return propertyConditions;
212 }
213};
214
Brad Bishopc1283ae2017-05-20 21:42:38 -0400215struct ConfigPropertyCallbacks
216{
217 using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
218
219 static auto& get()
220 {
221 static const Callbacks propertyCallbacks =
222 {
223% for c in callbacks:
224 ${c.construct(loader, indent=indent +3)},
225% endfor
226 };
227 return propertyCallbacks;
228 }
229};
230
Marri Devender Rao80c70612018-04-12 09:22:55 -0500231struct ConfigPathCallbacks
232{
233 using Callbacks = std::array<std::unique_ptr<Callback>, ${len(pathcallbacks)}>;
234
235 static auto& get()
236 {
237 static const Callbacks pathCallbacks =
238 {
239% for c in pathcallbacks:
240 ${c.construct(loader, indent=indent +3)},
241% endfor
242 };
243 return pathCallbacks;
244 }
245};
246
Brad Bishop4b916f12017-05-23 18:06:38 -0400247struct ConfigPropertyWatches
248{
249 using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
250
251 static auto& get()
252 {
253 static const PropertyWatches propertyWatches =
254 {
255% for w in watches:
256 std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
Brad Bishopfccdc392017-05-22 21:11:09 -0400257 % if w.callback is None:
Matthew Barthefe01582019-09-09 15:22:37 -0500258 % if w.filters is None:
Brad Bishop4b916f12017-05-23 18:06:38 -0400259 ConfigPropertyIndicies::get()[${w.instances}]),
Matthew Barthefe01582019-09-09 15:22:37 -0500260 % else:
261 ConfigPropertyIndicies::get()[${w.instances}],
Lei YU98d64622022-05-24 19:11:23 +0800262 ${w.ignore_start_callback},
Matthew Barthefe01582019-09-09 15:22:37 -0500263 ConfigPropertyFilters::get()[${w.filters}].get()),
264 % endif
Brad Bishopfccdc392017-05-22 21:11:09 -0400265 % else:
Matthew Barthefe01582019-09-09 15:22:37 -0500266 % if w.filters is None:
Brad Bishopfccdc392017-05-22 21:11:09 -0400267 ConfigPropertyIndicies::get()[${w.instances}],
Lei YU98d64622022-05-24 19:11:23 +0800268 *ConfigPropertyCallbacks::get()[${w.callback}],
269 ${w.ignore_start_callback}),
Matthew Barthefe01582019-09-09 15:22:37 -0500270 % else:
271 ConfigPropertyIndicies::get()[${w.instances}],
272 *ConfigPropertyCallbacks::get()[${w.callback}],
Lei YU98d64622022-05-24 19:11:23 +0800273 ${w.ignore_start_callback},
Matthew Barthefe01582019-09-09 15:22:37 -0500274 ConfigPropertyFilters::get()[${w.filters}].get()),
275 % endif
Brad Bishopfccdc392017-05-22 21:11:09 -0400276 % endif
Brad Bishop4b916f12017-05-23 18:06:38 -0400277% endfor
278 };
279 return propertyWatches;
280 }
281};
Marri Devender Rao80c70612018-04-12 09:22:55 -0500282
283struct ConfigPathWatches
284{
285 using PathWatches = std::array<std::unique_ptr<Watch>, ${len(pathwatches)}>;
286
287 static auto& get()
288 {
289 static const PathWatches pathWatches =
290 {
291% for w in pathwatches:
292 std::make_unique<PathWatch<SDBusPlus>>(
293 % if w.pathcallback is None:
294 ConfigIntfAddPaths::get()[${w.pathinstances}]),
295 % else:
296 ConfigIntfAddPaths::get()[${w.pathinstances}],
297 *ConfigPathCallbacks::get()[${w.pathcallback}]),
298 % endif
299% endfor
300 };
301 return pathWatches;
302 }
303};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400304} // namespace monitoring
305} // namespace dbus
306} // namespace phosphor