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