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