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