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