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