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