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