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