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