blob: d0a5ead0b2dd20282ee063e7ae7c674c9d7efdd7 [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"
Brad Bishop4b916f12017-05-23 18:06:38 -04009#include "data_types.hpp"
Brad Bishopc1283ae2017-05-20 21:42:38 -040010#include "journal.hpp"
Gunnar Millsd5faea32017-08-08 14:19:36 -050011#include "elog.hpp"
12#include "errors.hpp"
Brad Bishop0df00be2017-05-25 23:38:37 -040013#include "method.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040014#include "propertywatchimpl.hpp"
Marri Devender Rao80c70612018-04-12 09:22:55 -050015#include "pathwatchimpl.hpp"
Matt Spinler1d6ca482017-11-01 10:48:02 -050016#include "resolve_errors.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040017#include "sdbusplus.hpp"
Ratan Gupta90bfaea2017-10-06 20:56:31 +053018#include "event.hpp"
Marri Devender Rao80c70612018-04-12 09:22:55 -050019#include "snmp_trap.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040020
21using namespace std::string_literals;
Brad Bishop3539db62017-05-30 14:21:12 -040022using namespace std::chrono_literals;
Brad Bishop05b0c1e2017-05-23 00:24:01 -040023
Brad Bishop870c3fc2017-05-22 23:23:13 -040024namespace phosphor
25{
26namespace dbus
27{
28namespace monitoring
29{
30
Brad Bishop0e7df132017-05-23 17:58:12 -040031struct 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
47struct 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};
Brad Bishope73b2c32017-05-23 18:01:54 -040062
63struct 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
Marri Devender Rao80c70612018-04-12 09:22:55 -050079struct 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
Brad Bishope73b2c32017-05-23 18:01:54 -040095struct 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};
Brad Bishop4b916f12017-05-23 18:06:38 -0400110
111struct ConfigPropertyStorage
112{
Matt Spinlerabe43ab2018-02-19 13:34:43 -0600113 using Storage = std::array<std::tuple<any_ns::any, any_ns::any>, ${len(instances)}>;
Brad Bishop4b916f12017-05-23 18:06:38 -0400114
115 static auto& get()
116 {
117 static Storage storage;
118 return storage;
119 }
120};
121
122struct 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 {
Brad Bishop1ada93b2017-05-31 19:46:52 -0400137 ConfigPaths::get()[${i[0]}],
138 ConfigInterfaces::get()[${i[2]}],
139 ConfigProperties::get()[${i[3]}]
Brad Bishop4b916f12017-05-23 18:06:38 -0400140 },
141 PropertyIndex::mapped_type
142 {
Brad Bishop1ada93b2017-05-31 19:46:52 -0400143 ConfigMeta::get()[${i[1]}],
144 ConfigMeta::get()[${i[4]}],
145 ConfigPropertyStorage::get()[${i[5]}]
Brad Bishop4b916f12017-05-23 18:06:38 -0400146 },
147 },
148 % endfor
149 },
150% endfor
151 }
152 };
153 return propertyIndicies;
154 }
155};
156
Brad Bishop49e66172017-05-23 19:16:21 -0400157struct 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
Brad Bishop4041d722017-05-21 10:06:07 -0400174struct 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
Brad Bishopc1283ae2017-05-20 21:42:38 -0400190struct 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
Marri Devender Rao80c70612018-04-12 09:22:55 -0500206struct 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
Brad Bishop4b916f12017-05-23 18:06:38 -0400222struct 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>>(
Brad Bishopfccdc392017-05-22 21:11:09 -0400232 % if w.callback is None:
Brad Bishop4b916f12017-05-23 18:06:38 -0400233 ConfigPropertyIndicies::get()[${w.instances}]),
Brad Bishopfccdc392017-05-22 21:11:09 -0400234 % else:
235 ConfigPropertyIndicies::get()[${w.instances}],
236 *ConfigPropertyCallbacks::get()[${w.callback}]),
237 % endif
Brad Bishop4b916f12017-05-23 18:06:38 -0400238% endfor
239 };
240 return propertyWatches;
241 }
242};
Marri Devender Rao80c70612018-04-12 09:22:55 -0500243
244struct 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};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400265} // namespace monitoring
266} // namespace dbus
267} // namespace phosphor