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