Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 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 | |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 5 | #include <array> |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 6 | #include <chrono> |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 7 | #include <string> |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 8 | #include "count.hpp" |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 9 | #include "data_types.hpp" |
Brad Bishop | c1283ae | 2017-05-20 21:42:38 -0400 | [diff] [blame] | 10 | #include "journal.hpp" |
Gunnar Mills | d5faea3 | 2017-08-08 14:19:36 -0500 | [diff] [blame] | 11 | #include "elog.hpp" |
| 12 | #include "errors.hpp" |
Brad Bishop | 0df00be | 2017-05-25 23:38:37 -0400 | [diff] [blame] | 13 | #include "method.hpp" |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 14 | #include "propertywatchimpl.hpp" |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 15 | #include "pathwatchimpl.hpp" |
Matt Spinler | 1d6ca48 | 2017-11-01 10:48:02 -0500 | [diff] [blame] | 16 | #include "resolve_errors.hpp" |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 17 | #include "sdbusplus.hpp" |
Ratan Gupta | 90bfaea | 2017-10-06 20:56:31 +0530 | [diff] [blame] | 18 | #include "event.hpp" |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 19 | #include "snmp_trap.hpp" |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 20 | |
| 21 | using namespace std::string_literals; |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 22 | using namespace std::chrono_literals; |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 23 | |
Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 24 | namespace phosphor |
| 25 | { |
| 26 | namespace dbus |
| 27 | { |
| 28 | namespace monitoring |
| 29 | { |
| 30 | |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 31 | struct ConfigMeta |
| 32 | { |
| 33 | using Meta = std::array<std::string, ${len(meta)}>; |
| 34 | |
| 35 | static auto& get() |
| 36 | { |
| 37 | static const Meta meta = |
| 38 | { |
| 39 | % for m in meta: |
| 40 | "${m.name}"s, |
| 41 | % endfor |
| 42 | }; |
| 43 | return meta; |
| 44 | } |
| 45 | }; |
| 46 | |
| 47 | struct ConfigPaths |
| 48 | { |
| 49 | using Paths = std::array<std::string, ${len(paths)}>; |
| 50 | |
| 51 | static auto& get() |
| 52 | { |
| 53 | static const Paths paths = |
| 54 | { |
| 55 | % for p in paths: |
| 56 | "${p.name}"s, |
| 57 | % endfor |
| 58 | }; |
| 59 | return paths; |
| 60 | } |
| 61 | }; |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 62 | |
| 63 | struct ConfigInterfaces |
| 64 | { |
| 65 | using Interfaces = std::array<std::string, ${len(interfaces)}>; |
| 66 | |
| 67 | static auto& get() |
| 68 | { |
| 69 | static const Interfaces interfaces = |
| 70 | { |
| 71 | % for i in interfaces: |
| 72 | "${i.name}"s, |
| 73 | % endfor |
| 74 | }; |
| 75 | return interfaces; |
| 76 | } |
| 77 | }; |
| 78 | |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 79 | struct ConfigIntfAddPaths |
| 80 | { |
| 81 | using Paths = std::array<std::string, ${len(pathinstances)}>; |
| 82 | |
| 83 | static auto& get() |
| 84 | { |
| 85 | static const Paths paths = |
| 86 | { |
| 87 | % for p in pathinstances: |
| 88 | "${p.path}"s, |
| 89 | % endfor |
| 90 | }; |
| 91 | return paths; |
| 92 | } |
| 93 | }; |
| 94 | |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 95 | struct ConfigProperties |
| 96 | { |
| 97 | using Properties = std::array<std::string, ${len(propertynames)}>; |
| 98 | |
| 99 | static auto& get() |
| 100 | { |
| 101 | static const Properties properties = |
| 102 | { |
| 103 | % for p in propertynames: |
| 104 | "${p.name}"s, |
| 105 | % endfor |
| 106 | }; |
| 107 | return properties; |
| 108 | } |
| 109 | }; |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 110 | |
| 111 | struct ConfigPropertyStorage |
| 112 | { |
Matt Spinler | abe43ab | 2018-02-19 13:34:43 -0600 | [diff] [blame] | 113 | using Storage = std::array<std::tuple<any_ns::any, any_ns::any>, ${len(instances)}>; |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 114 | |
| 115 | static auto& get() |
| 116 | { |
| 117 | static Storage storage; |
| 118 | return storage; |
| 119 | } |
| 120 | }; |
| 121 | |
| 122 | struct ConfigPropertyIndicies |
| 123 | { |
| 124 | using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>; |
| 125 | |
| 126 | static auto& get() |
| 127 | { |
| 128 | static const PropertyIndicies propertyIndicies = |
| 129 | { |
| 130 | { |
| 131 | % for g in instancegroups: |
| 132 | { |
| 133 | % for i in g.members: |
| 134 | { |
| 135 | PropertyIndex::key_type |
| 136 | { |
Brad Bishop | 1ada93b | 2017-05-31 19:46:52 -0400 | [diff] [blame] | 137 | ConfigPaths::get()[${i[0]}], |
| 138 | ConfigInterfaces::get()[${i[2]}], |
| 139 | ConfigProperties::get()[${i[3]}] |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 140 | }, |
| 141 | PropertyIndex::mapped_type |
| 142 | { |
Brad Bishop | 1ada93b | 2017-05-31 19:46:52 -0400 | [diff] [blame] | 143 | ConfigMeta::get()[${i[1]}], |
| 144 | ConfigMeta::get()[${i[4]}], |
| 145 | ConfigPropertyStorage::get()[${i[5]}] |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 146 | }, |
| 147 | }, |
| 148 | % endfor |
| 149 | }, |
| 150 | % endfor |
| 151 | } |
| 152 | }; |
| 153 | return propertyIndicies; |
| 154 | } |
| 155 | }; |
| 156 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 157 | struct ConfigPropertyCallbackGroups |
| 158 | { |
| 159 | using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>; |
| 160 | static auto& get() |
| 161 | { |
| 162 | static const CallbackGroups propertyCallbackGraph = |
| 163 | { |
| 164 | { |
| 165 | % for g in callbackgroups: |
| 166 | {${', '.join([str(x) for x in g.members])}}, |
| 167 | % endfor |
| 168 | } |
| 169 | }; |
| 170 | return propertyCallbackGraph; |
| 171 | } |
| 172 | }; |
| 173 | |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 174 | struct ConfigConditions |
| 175 | { |
| 176 | using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>; |
| 177 | |
| 178 | static auto& get() |
| 179 | { |
| 180 | static const Conditions propertyConditions = |
| 181 | { |
| 182 | % for c in conditions: |
| 183 | ${c.construct(loader, indent=indent +3)}, |
| 184 | % endfor |
| 185 | }; |
| 186 | return propertyConditions; |
| 187 | } |
| 188 | }; |
| 189 | |
Brad Bishop | c1283ae | 2017-05-20 21:42:38 -0400 | [diff] [blame] | 190 | struct ConfigPropertyCallbacks |
| 191 | { |
| 192 | using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>; |
| 193 | |
| 194 | static auto& get() |
| 195 | { |
| 196 | static const Callbacks propertyCallbacks = |
| 197 | { |
| 198 | % for c in callbacks: |
| 199 | ${c.construct(loader, indent=indent +3)}, |
| 200 | % endfor |
| 201 | }; |
| 202 | return propertyCallbacks; |
| 203 | } |
| 204 | }; |
| 205 | |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 206 | struct ConfigPathCallbacks |
| 207 | { |
| 208 | using Callbacks = std::array<std::unique_ptr<Callback>, ${len(pathcallbacks)}>; |
| 209 | |
| 210 | static auto& get() |
| 211 | { |
| 212 | static const Callbacks pathCallbacks = |
| 213 | { |
| 214 | % for c in pathcallbacks: |
| 215 | ${c.construct(loader, indent=indent +3)}, |
| 216 | % endfor |
| 217 | }; |
| 218 | return pathCallbacks; |
| 219 | } |
| 220 | }; |
| 221 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 222 | struct ConfigPropertyWatches |
| 223 | { |
| 224 | using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>; |
| 225 | |
| 226 | static auto& get() |
| 227 | { |
| 228 | static const PropertyWatches propertyWatches = |
| 229 | { |
| 230 | % for w in watches: |
| 231 | std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>( |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 232 | % if w.callback is None: |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 233 | ConfigPropertyIndicies::get()[${w.instances}]), |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 234 | % else: |
| 235 | ConfigPropertyIndicies::get()[${w.instances}], |
| 236 | *ConfigPropertyCallbacks::get()[${w.callback}]), |
| 237 | % endif |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 238 | % endfor |
| 239 | }; |
| 240 | return propertyWatches; |
| 241 | } |
| 242 | }; |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 243 | |
| 244 | struct ConfigPathWatches |
| 245 | { |
| 246 | using PathWatches = std::array<std::unique_ptr<Watch>, ${len(pathwatches)}>; |
| 247 | |
| 248 | static auto& get() |
| 249 | { |
| 250 | static const PathWatches pathWatches = |
| 251 | { |
| 252 | % for w in pathwatches: |
| 253 | std::make_unique<PathWatch<SDBusPlus>>( |
| 254 | % if w.pathcallback is None: |
| 255 | ConfigIntfAddPaths::get()[${w.pathinstances}]), |
| 256 | % else: |
| 257 | ConfigIntfAddPaths::get()[${w.pathinstances}], |
| 258 | *ConfigPathCallbacks::get()[${w.pathcallback}]), |
| 259 | % endif |
| 260 | % endfor |
| 261 | }; |
| 262 | return pathWatches; |
| 263 | } |
| 264 | }; |
Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 265 | } // namespace monitoring |
| 266 | } // namespace dbus |
| 267 | } // namespace phosphor |