1870c3fc6SBrad Bishop ## This file is a template, the comment below is emitted into the generated file
2870c3fc6SBrad Bishop /* This is an auto generated file. Do not edit. */
3870c3fc6SBrad Bishop #pragma once
4870c3fc6SBrad Bishop 
505b0c1eeSBrad Bishop #include <array>
63539db64SBrad Bishop #include <chrono>
705b0c1eeSBrad Bishop #include <string>
84041d720SBrad Bishop #include "count.hpp"
94b916f13SBrad Bishop #include "data_types.hpp"
10c1283ae8SBrad Bishop #include "journal.hpp"
11*d5faea31SGunnar Mills #include "elog.hpp"
12*d5faea31SGunnar Mills #include "errors.hpp"
130df00be0SBrad Bishop #include "method.hpp"
144b916f13SBrad Bishop #include "propertywatchimpl.hpp"
154b916f13SBrad Bishop #include "sdbusplus.hpp"
16aabc5461SBrad Bishop #include "sdevent.hpp"
1705b0c1eeSBrad Bishop 
1805b0c1eeSBrad Bishop using namespace std::string_literals;
193539db64SBrad Bishop using namespace std::chrono_literals;
2005b0c1eeSBrad Bishop 
21870c3fc6SBrad Bishop namespace phosphor
22870c3fc6SBrad Bishop {
23870c3fc6SBrad Bishop namespace dbus
24870c3fc6SBrad Bishop {
25870c3fc6SBrad Bishop namespace monitoring
26870c3fc6SBrad Bishop {
27870c3fc6SBrad Bishop 
280e7df131SBrad Bishop struct ConfigMeta
290e7df131SBrad Bishop {
300e7df131SBrad Bishop     using Meta = std::array<std::string, ${len(meta)}>;
310e7df131SBrad Bishop 
320e7df131SBrad Bishop     static auto& get()
330e7df131SBrad Bishop     {
340e7df131SBrad Bishop         static const Meta meta =
350e7df131SBrad Bishop         {
360e7df131SBrad Bishop % for m in meta:
370e7df131SBrad Bishop             "${m.name}"s,
380e7df131SBrad Bishop % endfor
390e7df131SBrad Bishop         };
400e7df131SBrad Bishop         return meta;
410e7df131SBrad Bishop     }
420e7df131SBrad Bishop };
430e7df131SBrad Bishop 
440e7df131SBrad Bishop struct ConfigPaths
450e7df131SBrad Bishop {
460e7df131SBrad Bishop     using Paths = std::array<std::string, ${len(paths)}>;
470e7df131SBrad Bishop 
480e7df131SBrad Bishop     static auto& get()
490e7df131SBrad Bishop     {
500e7df131SBrad Bishop         static const Paths paths =
510e7df131SBrad Bishop         {
520e7df131SBrad Bishop % for p in paths:
530e7df131SBrad Bishop             "${p.name}"s,
540e7df131SBrad Bishop % endfor
550e7df131SBrad Bishop         };
560e7df131SBrad Bishop         return paths;
570e7df131SBrad Bishop     }
580e7df131SBrad Bishop };
59e73b2c35SBrad Bishop 
60e73b2c35SBrad Bishop struct ConfigInterfaces
61e73b2c35SBrad Bishop {
62e73b2c35SBrad Bishop     using Interfaces = std::array<std::string, ${len(interfaces)}>;
63e73b2c35SBrad Bishop 
64e73b2c35SBrad Bishop     static auto& get()
65e73b2c35SBrad Bishop     {
66e73b2c35SBrad Bishop         static const Interfaces interfaces =
67e73b2c35SBrad Bishop         {
68e73b2c35SBrad Bishop % for i in interfaces:
69e73b2c35SBrad Bishop             "${i.name}"s,
70e73b2c35SBrad Bishop % endfor
71e73b2c35SBrad Bishop         };
72e73b2c35SBrad Bishop         return interfaces;
73e73b2c35SBrad Bishop     }
74e73b2c35SBrad Bishop };
75e73b2c35SBrad Bishop 
76e73b2c35SBrad Bishop struct ConfigProperties
77e73b2c35SBrad Bishop {
78e73b2c35SBrad Bishop     using Properties = std::array<std::string, ${len(propertynames)}>;
79e73b2c35SBrad Bishop 
80e73b2c35SBrad Bishop     static auto& get()
81e73b2c35SBrad Bishop     {
82e73b2c35SBrad Bishop         static const Properties properties =
83e73b2c35SBrad Bishop         {
84e73b2c35SBrad Bishop % for p in propertynames:
85e73b2c35SBrad Bishop             "${p.name}"s,
86e73b2c35SBrad Bishop % endfor
87e73b2c35SBrad Bishop         };
88e73b2c35SBrad Bishop         return properties;
89e73b2c35SBrad Bishop     }
90e73b2c35SBrad Bishop };
914b916f13SBrad Bishop 
924b916f13SBrad Bishop struct ConfigPropertyStorage
934b916f13SBrad Bishop {
944b916f13SBrad Bishop     using Storage = std::array<any_ns::any, ${len(instances)}>;
954b916f13SBrad Bishop 
964b916f13SBrad Bishop     static auto& get()
974b916f13SBrad Bishop     {
984b916f13SBrad Bishop         static Storage storage;
994b916f13SBrad Bishop         return storage;
1004b916f13SBrad Bishop     }
1014b916f13SBrad Bishop };
1024b916f13SBrad Bishop 
1034b916f13SBrad Bishop struct ConfigPropertyIndicies
1044b916f13SBrad Bishop {
1054b916f13SBrad Bishop     using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>;
1064b916f13SBrad Bishop 
1074b916f13SBrad Bishop     static auto& get()
1084b916f13SBrad Bishop     {
1094b916f13SBrad Bishop         static const PropertyIndicies propertyIndicies =
1104b916f13SBrad Bishop         {
1114b916f13SBrad Bishop             {
1124b916f13SBrad Bishop % for g in instancegroups:
1134b916f13SBrad Bishop                 {
1144b916f13SBrad Bishop     % for i in g.members:
1154b916f13SBrad Bishop                     {
1164b916f13SBrad Bishop                         PropertyIndex::key_type
1174b916f13SBrad Bishop                         {
1181ada93beSBrad Bishop                             ConfigPaths::get()[${i[0]}],
1191ada93beSBrad Bishop                             ConfigInterfaces::get()[${i[2]}],
1201ada93beSBrad Bishop                             ConfigProperties::get()[${i[3]}]
1214b916f13SBrad Bishop                         },
1224b916f13SBrad Bishop                         PropertyIndex::mapped_type
1234b916f13SBrad Bishop                         {
1241ada93beSBrad Bishop                             ConfigMeta::get()[${i[1]}],
1251ada93beSBrad Bishop                             ConfigMeta::get()[${i[4]}],
1261ada93beSBrad Bishop                             ConfigPropertyStorage::get()[${i[5]}]
1274b916f13SBrad Bishop                         },
1284b916f13SBrad Bishop                     },
1294b916f13SBrad Bishop     % endfor
1304b916f13SBrad Bishop                 },
1314b916f13SBrad Bishop % endfor
1324b916f13SBrad Bishop             }
1334b916f13SBrad Bishop         };
1344b916f13SBrad Bishop         return propertyIndicies;
1354b916f13SBrad Bishop     }
1364b916f13SBrad Bishop };
1374b916f13SBrad Bishop 
13849e66175SBrad Bishop struct ConfigPropertyCallbackGroups
13949e66175SBrad Bishop {
14049e66175SBrad Bishop     using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
14149e66175SBrad Bishop     static auto& get()
14249e66175SBrad Bishop     {
14349e66175SBrad Bishop         static const CallbackGroups propertyCallbackGraph =
14449e66175SBrad Bishop         {
14549e66175SBrad Bishop             {
14649e66175SBrad Bishop % for g in callbackgroups:
14749e66175SBrad Bishop                 {${', '.join([str(x) for x in g.members])}},
14849e66175SBrad Bishop % endfor
14949e66175SBrad Bishop             }
15049e66175SBrad Bishop         };
15149e66175SBrad Bishop         return propertyCallbackGraph;
15249e66175SBrad Bishop     }
15349e66175SBrad Bishop };
15449e66175SBrad Bishop 
1554041d720SBrad Bishop struct ConfigConditions
1564041d720SBrad Bishop {
1574041d720SBrad Bishop     using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
1584041d720SBrad Bishop 
1594041d720SBrad Bishop     static auto& get()
1604041d720SBrad Bishop     {
1614041d720SBrad Bishop         static const Conditions propertyConditions =
1624041d720SBrad Bishop         {
1634041d720SBrad Bishop % for c in conditions:
1644041d720SBrad Bishop             ${c.construct(loader, indent=indent +3)},
1654041d720SBrad Bishop % endfor
1664041d720SBrad Bishop         };
1674041d720SBrad Bishop         return propertyConditions;
1684041d720SBrad Bishop     }
1694041d720SBrad Bishop };
1704041d720SBrad Bishop 
171c1283ae8SBrad Bishop struct ConfigPropertyCallbacks
172c1283ae8SBrad Bishop {
173c1283ae8SBrad Bishop     using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
174c1283ae8SBrad Bishop 
175c1283ae8SBrad Bishop     static auto& get()
176c1283ae8SBrad Bishop     {
177c1283ae8SBrad Bishop         static const Callbacks propertyCallbacks =
178c1283ae8SBrad Bishop         {
179c1283ae8SBrad Bishop % for c in callbacks:
180c1283ae8SBrad Bishop             ${c.construct(loader, indent=indent +3)},
181c1283ae8SBrad Bishop % endfor
182c1283ae8SBrad Bishop         };
183c1283ae8SBrad Bishop         return propertyCallbacks;
184c1283ae8SBrad Bishop     }
185c1283ae8SBrad Bishop };
186c1283ae8SBrad Bishop 
1874b916f13SBrad Bishop struct ConfigPropertyWatches
1884b916f13SBrad Bishop {
1894b916f13SBrad Bishop     using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
1904b916f13SBrad Bishop 
1914b916f13SBrad Bishop     static auto& get()
1924b916f13SBrad Bishop     {
1934b916f13SBrad Bishop         static const PropertyWatches propertyWatches =
1944b916f13SBrad Bishop         {
1954b916f13SBrad Bishop % for w in watches:
1964b916f13SBrad Bishop             std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>(
197fccdc39fSBrad Bishop     % if w.callback is None:
1984b916f13SBrad Bishop                 ConfigPropertyIndicies::get()[${w.instances}]),
199fccdc39fSBrad Bishop     % else:
200fccdc39fSBrad Bishop                 ConfigPropertyIndicies::get()[${w.instances}],
201fccdc39fSBrad Bishop                 *ConfigPropertyCallbacks::get()[${w.callback}]),
202fccdc39fSBrad Bishop     % endif
2034b916f13SBrad Bishop % endfor
2044b916f13SBrad Bishop         };
2054b916f13SBrad Bishop         return propertyWatches;
2064b916f13SBrad Bishop     }
2074b916f13SBrad Bishop };
208870c3fc6SBrad Bishop } // namespace monitoring
209870c3fc6SBrad Bishop } // namespace dbus
210870c3fc6SBrad Bishop } // namespace phosphor
211