blob: 9e89983ee2fa2e31f24f8277ada39bd713cb2baa [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>
6#include <string>
Brad Bishop4041d722017-05-21 10:06:07 -04007#include "count.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -04008#include "data_types.hpp"
Brad Bishopc1283ae2017-05-20 21:42:38 -04009#include "journal.hpp"
Brad Bishop0df00be2017-05-25 23:38:37 -040010#include "method.hpp"
Brad Bishop4b916f12017-05-23 18:06:38 -040011#include "propertywatchimpl.hpp"
12#include "sdbusplus.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040013
14using namespace std::string_literals;
15
Brad Bishop870c3fc2017-05-22 23:23:13 -040016namespace phosphor
17{
18namespace dbus
19{
20namespace monitoring
21{
22
Brad Bishop0e7df132017-05-23 17:58:12 -040023struct ConfigMeta
24{
25 using Meta = std::array<std::string, ${len(meta)}>;
26
27 static auto& get()
28 {
29 static const Meta meta =
30 {
31% for m in meta:
32 "${m.name}"s,
33% endfor
34 };
35 return meta;
36 }
37};
38
39struct ConfigPaths
40{
41 using Paths = std::array<std::string, ${len(paths)}>;
42
43 static auto& get()
44 {
45 static const Paths paths =
46 {
47% for p in paths:
48 "${p.name}"s,
49% endfor
50 };
51 return paths;
52 }
53};
Brad Bishope73b2c32017-05-23 18:01:54 -040054
55struct ConfigInterfaces
56{
57 using Interfaces = std::array<std::string, ${len(interfaces)}>;
58
59 static auto& get()
60 {
61 static const Interfaces interfaces =
62 {
63% for i in interfaces:
64 "${i.name}"s,
65% endfor
66 };
67 return interfaces;
68 }
69};
70
71struct ConfigProperties
72{
73 using Properties = std::array<std::string, ${len(propertynames)}>;
74
75 static auto& get()
76 {
77 static const Properties properties =
78 {
79% for p in propertynames:
80 "${p.name}"s,
81% endfor
82 };
83 return properties;
84 }
85};
Brad Bishop4b916f12017-05-23 18:06:38 -040086
87struct ConfigPropertyStorage
88{
89 using Storage = std::array<any_ns::any, ${len(instances)}>;
90
91 static auto& get()
92 {
93 static Storage storage;
94 return storage;
95 }
96};
97
98struct ConfigPropertyIndicies
99{
100 using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
101
102 static auto& get()
103 {
104 static const PropertyIndicies propertyIndicies =
105 {
106 {
107% for g in instancegroups:
108 {
109 % for i in g.members:
110 {
111 PropertyIndex::key_type
112 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400113 std::cref(ConfigPaths::get()[${i[0]}]),
114 std::cref(ConfigInterfaces::get()[${i[2]}]),
115 std::cref(ConfigProperties::get()[${i[3]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400116 },
117 PropertyIndex::mapped_type
118 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400119 std::cref(ConfigMeta::get()[${i[1]}]),
120 std::cref(ConfigMeta::get()[${i[4]}]),
121 std::ref(ConfigPropertyStorage::get()[${i[5]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400122 },
123 },
124 % endfor
125 },
126% endfor
127 }
128 };
129 return propertyIndicies;
130 }
131};
132
Brad Bishop49e66172017-05-23 19:16:21 -0400133struct ConfigPropertyCallbackGroups
134{
135 using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
136 static auto& get()
137 {
138 static const CallbackGroups propertyCallbackGraph =
139 {
140 {
141% for g in callbackgroups:
142 {${', '.join([str(x) for x in g.members])}},
143% endfor
144 }
145 };
146 return propertyCallbackGraph;
147 }
148};
149
Brad Bishop4041d722017-05-21 10:06:07 -0400150struct ConfigConditions
151{
152 using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
153
154 static auto& get()
155 {
156 static const Conditions propertyConditions =
157 {
158% for c in conditions:
159 ${c.construct(loader, indent=indent +3)},
160% endfor
161 };
162 return propertyConditions;
163 }
164};
165
Brad Bishopc1283ae2017-05-20 21:42:38 -0400166struct ConfigPropertyCallbacks
167{
168 using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
169
170 static auto& get()
171 {
172 static const Callbacks propertyCallbacks =
173 {
174% for c in callbacks:
175 ${c.construct(loader, indent=indent +3)},
176% endfor
177 };
178 return propertyCallbacks;
179 }
180};
181
Brad Bishop4b916f12017-05-23 18:06:38 -0400182struct ConfigPropertyWatches
183{
184 using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
185
186 static auto& get()
187 {
188 static const PropertyWatches propertyWatches =
189 {
190% for w in watches:
191 std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
Brad Bishopfccdc392017-05-22 21:11:09 -0400192 % if w.callback is None:
Brad Bishop4b916f12017-05-23 18:06:38 -0400193 ConfigPropertyIndicies::get()[${w.instances}]),
Brad Bishopfccdc392017-05-22 21:11:09 -0400194 % else:
195 ConfigPropertyIndicies::get()[${w.instances}],
196 *ConfigPropertyCallbacks::get()[${w.callback}]),
197 % endif
Brad Bishop4b916f12017-05-23 18:06:38 -0400198% endfor
199 };
200 return propertyWatches;
201 }
202};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400203} // namespace monitoring
204} // namespace dbus
205} // namespace phosphor