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" |
Matt Spinler | 1d6ca48 | 2017-11-01 10:48:02 -0500 | [diff] [blame^] | 15 | #include "resolve_errors.hpp" |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 16 | #include "sdbusplus.hpp" |
Brad Bishop | aabc546 | 2017-05-30 12:39:22 -0400 | [diff] [blame] | 17 | #include "sdevent.hpp" |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 18 | |
| 19 | using namespace std::string_literals; |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 20 | using namespace std::chrono_literals; |
Brad Bishop | 05b0c1e | 2017-05-23 00:24:01 -0400 | [diff] [blame] | 21 | |
Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 22 | namespace phosphor |
| 23 | { |
| 24 | namespace dbus |
| 25 | { |
| 26 | namespace monitoring |
| 27 | { |
| 28 | |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 29 | struct ConfigMeta |
| 30 | { |
| 31 | using Meta = std::array<std::string, ${len(meta)}>; |
| 32 | |
| 33 | static auto& get() |
| 34 | { |
| 35 | static const Meta meta = |
| 36 | { |
| 37 | % for m in meta: |
| 38 | "${m.name}"s, |
| 39 | % endfor |
| 40 | }; |
| 41 | return meta; |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | struct ConfigPaths |
| 46 | { |
| 47 | using Paths = std::array<std::string, ${len(paths)}>; |
| 48 | |
| 49 | static auto& get() |
| 50 | { |
| 51 | static const Paths paths = |
| 52 | { |
| 53 | % for p in paths: |
| 54 | "${p.name}"s, |
| 55 | % endfor |
| 56 | }; |
| 57 | return paths; |
| 58 | } |
| 59 | }; |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 60 | |
| 61 | struct ConfigInterfaces |
| 62 | { |
| 63 | using Interfaces = std::array<std::string, ${len(interfaces)}>; |
| 64 | |
| 65 | static auto& get() |
| 66 | { |
| 67 | static const Interfaces interfaces = |
| 68 | { |
| 69 | % for i in interfaces: |
| 70 | "${i.name}"s, |
| 71 | % endfor |
| 72 | }; |
| 73 | return interfaces; |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | struct ConfigProperties |
| 78 | { |
| 79 | using Properties = std::array<std::string, ${len(propertynames)}>; |
| 80 | |
| 81 | static auto& get() |
| 82 | { |
| 83 | static const Properties properties = |
| 84 | { |
| 85 | % for p in propertynames: |
| 86 | "${p.name}"s, |
| 87 | % endfor |
| 88 | }; |
| 89 | return properties; |
| 90 | } |
| 91 | }; |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 92 | |
| 93 | struct ConfigPropertyStorage |
| 94 | { |
| 95 | using Storage = std::array<any_ns::any, ${len(instances)}>; |
| 96 | |
| 97 | static auto& get() |
| 98 | { |
| 99 | static Storage storage; |
| 100 | return storage; |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | struct ConfigPropertyIndicies |
| 105 | { |
| 106 | using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>; |
| 107 | |
| 108 | static auto& get() |
| 109 | { |
| 110 | static const PropertyIndicies propertyIndicies = |
| 111 | { |
| 112 | { |
| 113 | % for g in instancegroups: |
| 114 | { |
| 115 | % for i in g.members: |
| 116 | { |
| 117 | PropertyIndex::key_type |
| 118 | { |
Brad Bishop | 1ada93b | 2017-05-31 19:46:52 -0400 | [diff] [blame] | 119 | ConfigPaths::get()[${i[0]}], |
| 120 | ConfigInterfaces::get()[${i[2]}], |
| 121 | ConfigProperties::get()[${i[3]}] |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 122 | }, |
| 123 | PropertyIndex::mapped_type |
| 124 | { |
Brad Bishop | 1ada93b | 2017-05-31 19:46:52 -0400 | [diff] [blame] | 125 | ConfigMeta::get()[${i[1]}], |
| 126 | ConfigMeta::get()[${i[4]}], |
| 127 | ConfigPropertyStorage::get()[${i[5]}] |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 128 | }, |
| 129 | }, |
| 130 | % endfor |
| 131 | }, |
| 132 | % endfor |
| 133 | } |
| 134 | }; |
| 135 | return propertyIndicies; |
| 136 | } |
| 137 | }; |
| 138 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 139 | struct ConfigPropertyCallbackGroups |
| 140 | { |
| 141 | using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>; |
| 142 | static auto& get() |
| 143 | { |
| 144 | static const CallbackGroups propertyCallbackGraph = |
| 145 | { |
| 146 | { |
| 147 | % for g in callbackgroups: |
| 148 | {${', '.join([str(x) for x in g.members])}}, |
| 149 | % endfor |
| 150 | } |
| 151 | }; |
| 152 | return propertyCallbackGraph; |
| 153 | } |
| 154 | }; |
| 155 | |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 156 | struct ConfigConditions |
| 157 | { |
| 158 | using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>; |
| 159 | |
| 160 | static auto& get() |
| 161 | { |
| 162 | static const Conditions propertyConditions = |
| 163 | { |
| 164 | % for c in conditions: |
| 165 | ${c.construct(loader, indent=indent +3)}, |
| 166 | % endfor |
| 167 | }; |
| 168 | return propertyConditions; |
| 169 | } |
| 170 | }; |
| 171 | |
Brad Bishop | c1283ae | 2017-05-20 21:42:38 -0400 | [diff] [blame] | 172 | struct ConfigPropertyCallbacks |
| 173 | { |
| 174 | using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>; |
| 175 | |
| 176 | static auto& get() |
| 177 | { |
| 178 | static const Callbacks propertyCallbacks = |
| 179 | { |
| 180 | % for c in callbacks: |
| 181 | ${c.construct(loader, indent=indent +3)}, |
| 182 | % endfor |
| 183 | }; |
| 184 | return propertyCallbacks; |
| 185 | } |
| 186 | }; |
| 187 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 188 | struct ConfigPropertyWatches |
| 189 | { |
| 190 | using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>; |
| 191 | |
| 192 | static auto& get() |
| 193 | { |
| 194 | static const PropertyWatches propertyWatches = |
| 195 | { |
| 196 | % for w in watches: |
| 197 | std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>( |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 198 | % if w.callback is None: |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 199 | ConfigPropertyIndicies::get()[${w.instances}]), |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 200 | % else: |
| 201 | ConfigPropertyIndicies::get()[${w.instances}], |
| 202 | *ConfigPropertyCallbacks::get()[${w.callback}]), |
| 203 | % endif |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 204 | % endfor |
| 205 | }; |
| 206 | return propertyWatches; |
| 207 | } |
| 208 | }; |
Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 209 | } // namespace monitoring |
| 210 | } // namespace dbus |
| 211 | } // namespace phosphor |