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