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