blob: a4819e20f23868f9f87c9c7fc581ba905d9a9abd [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 Bishop4b916f12017-05-23 18:06:38 -040010#include "propertywatchimpl.hpp"
11#include "sdbusplus.hpp"
Brad Bishop05b0c1e2017-05-23 00:24:01 -040012
13using namespace std::string_literals;
14
Brad Bishop870c3fc2017-05-22 23:23:13 -040015namespace phosphor
16{
17namespace dbus
18{
19namespace monitoring
20{
21
Brad Bishop0e7df132017-05-23 17:58:12 -040022struct ConfigMeta
23{
24 using Meta = std::array<std::string, ${len(meta)}>;
25
26 static auto& get()
27 {
28 static const Meta meta =
29 {
30% for m in meta:
31 "${m.name}"s,
32% endfor
33 };
34 return meta;
35 }
36};
37
38struct ConfigPaths
39{
40 using Paths = std::array<std::string, ${len(paths)}>;
41
42 static auto& get()
43 {
44 static const Paths paths =
45 {
46% for p in paths:
47 "${p.name}"s,
48% endfor
49 };
50 return paths;
51 }
52};
Brad Bishope73b2c32017-05-23 18:01:54 -040053
54struct ConfigInterfaces
55{
56 using Interfaces = std::array<std::string, ${len(interfaces)}>;
57
58 static auto& get()
59 {
60 static const Interfaces interfaces =
61 {
62% for i in interfaces:
63 "${i.name}"s,
64% endfor
65 };
66 return interfaces;
67 }
68};
69
70struct ConfigProperties
71{
72 using Properties = std::array<std::string, ${len(propertynames)}>;
73
74 static auto& get()
75 {
76 static const Properties properties =
77 {
78% for p in propertynames:
79 "${p.name}"s,
80% endfor
81 };
82 return properties;
83 }
84};
Brad Bishop4b916f12017-05-23 18:06:38 -040085
86struct ConfigPropertyStorage
87{
88 using Storage = std::array<any_ns::any, ${len(instances)}>;
89
90 static auto& get()
91 {
92 static Storage storage;
93 return storage;
94 }
95};
96
97struct ConfigPropertyIndicies
98{
99 using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
100
101 static auto& get()
102 {
103 static const PropertyIndicies propertyIndicies =
104 {
105 {
106% for g in instancegroups:
107 {
108 % for i in g.members:
109 {
110 PropertyIndex::key_type
111 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400112 std::cref(ConfigPaths::get()[${i[0]}]),
113 std::cref(ConfigInterfaces::get()[${i[2]}]),
114 std::cref(ConfigProperties::get()[${i[3]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400115 },
116 PropertyIndex::mapped_type
117 {
Brad Bishopc1283ae2017-05-20 21:42:38 -0400118 std::cref(ConfigMeta::get()[${i[1]}]),
119 std::cref(ConfigMeta::get()[${i[4]}]),
120 std::ref(ConfigPropertyStorage::get()[${i[5]}])
Brad Bishop4b916f12017-05-23 18:06:38 -0400121 },
122 },
123 % endfor
124 },
125% endfor
126 }
127 };
128 return propertyIndicies;
129 }
130};
131
Brad Bishop49e66172017-05-23 19:16:21 -0400132struct ConfigPropertyCallbackGroups
133{
134 using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
135 static auto& get()
136 {
137 static const CallbackGroups propertyCallbackGraph =
138 {
139 {
140% for g in callbackgroups:
141 {${', '.join([str(x) for x in g.members])}},
142% endfor
143 }
144 };
145 return propertyCallbackGraph;
146 }
147};
148
Brad Bishop4041d722017-05-21 10:06:07 -0400149struct ConfigConditions
150{
151 using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
152
153 static auto& get()
154 {
155 static const Conditions propertyConditions =
156 {
157% for c in conditions:
158 ${c.construct(loader, indent=indent +3)},
159% endfor
160 };
161 return propertyConditions;
162 }
163};
164
Brad Bishopc1283ae2017-05-20 21:42:38 -0400165struct ConfigPropertyCallbacks
166{
167 using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
168
169 static auto& get()
170 {
171 static const Callbacks propertyCallbacks =
172 {
173% for c in callbacks:
174 ${c.construct(loader, indent=indent +3)},
175% endfor
176 };
177 return propertyCallbacks;
178 }
179};
180
Brad Bishop4b916f12017-05-23 18:06:38 -0400181struct ConfigPropertyWatches
182{
183 using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
184
185 static auto& get()
186 {
187 static const PropertyWatches propertyWatches =
188 {
189% for w in watches:
190 std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
191 ConfigPropertyIndicies::get()[${w.instances}]),
192% endfor
193 };
194 return propertyWatches;
195 }
196};
Brad Bishop870c3fc2017-05-22 23:23:13 -0400197} // namespace monitoring
198} // namespace dbus
199} // namespace phosphor