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