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