1 ## 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 
5 #include <array>
6 #include <chrono>
7 #include <string>
8 #include "count.hpp"
9 #include "data_types.hpp"
10 #include "journal.hpp"
11 #include "method.hpp"
12 #include "propertywatchimpl.hpp"
13 #include "sdbusplus.hpp"
14 #include "sdevent.hpp"
15 
16 using namespace std::string_literals;
17 using namespace std::chrono_literals;
18 
19 namespace phosphor
20 {
21 namespace dbus
22 {
23 namespace monitoring
24 {
25 
26 struct 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 
42 struct 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 };
57 
58 struct 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 
74 struct 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 };
89 
90 struct 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 
101 struct 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                         {
116                             ConfigPaths::get()[${i[0]}],
117                             ConfigInterfaces::get()[${i[2]}],
118                             ConfigProperties::get()[${i[3]}]
119                         },
120                         PropertyIndex::mapped_type
121                         {
122                             ConfigMeta::get()[${i[1]}],
123                             ConfigMeta::get()[${i[4]}],
124                             ConfigPropertyStorage::get()[${i[5]}]
125                         },
126                     },
127     % endfor
128                 },
129 % endfor
130             }
131         };
132         return propertyIndicies;
133     }
134 };
135 
136 struct 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 
153 struct 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 
169 struct 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 
185 struct 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>>(
195     % if w.callback is None:
196                 ConfigPropertyIndicies::get()[${w.instances}]),
197     % else:
198                 ConfigPropertyIndicies::get()[${w.instances}],
199                 *ConfigPropertyCallbacks::get()[${w.callback}]),
200     % endif
201 % endfor
202         };
203         return propertyWatches;
204     }
205 };
206 } // namespace monitoring
207 } // namespace dbus
208 } // namespace phosphor
209