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