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