1870c3fc6SBrad Bishop ## This file is a template, the comment below is emitted into the generated file 2870c3fc6SBrad Bishop /* This is an auto generated file. Do not edit. */ 3870c3fc6SBrad Bishop #pragma once 4870c3fc6SBrad Bishop 505b0c1eeSBrad Bishop #include <array> 63539db64SBrad Bishop #include <chrono> 705b0c1eeSBrad Bishop #include <string> 84041d720SBrad Bishop #include "count.hpp" 9efdd03c2SMatthew Barth #include "median.hpp" 104b916f13SBrad Bishop #include "data_types.hpp" 11c1283ae8SBrad Bishop #include "journal.hpp" 12d5faea31SGunnar Mills #include "elog.hpp" 13d5faea31SGunnar Mills #include "errors.hpp" 140df00be0SBrad Bishop #include "method.hpp" 154b916f13SBrad Bishop #include "propertywatchimpl.hpp" 1680c70610SMarri Devender Rao #include "pathwatchimpl.hpp" 171d6ca484SMatt Spinler #include "resolve_errors.hpp" 184b916f13SBrad Bishop #include "sdbusplus.hpp" 1990bfaea4SRatan Gupta #include "event.hpp" 2080c70610SMarri Devender Rao #include "snmp_trap.hpp" 2105b0c1eeSBrad Bishop 2205b0c1eeSBrad Bishop using namespace std::string_literals; 233539db64SBrad Bishop using namespace std::chrono_literals; 2405b0c1eeSBrad Bishop 25870c3fc6SBrad Bishop namespace phosphor 26870c3fc6SBrad Bishop { 27870c3fc6SBrad Bishop namespace dbus 28870c3fc6SBrad Bishop { 29870c3fc6SBrad Bishop namespace monitoring 30870c3fc6SBrad Bishop { 31870c3fc6SBrad Bishop 320e7df131SBrad Bishop struct ConfigMeta 330e7df131SBrad Bishop { 340e7df131SBrad Bishop using Meta = std::array<std::string, ${len(meta)}>; 350e7df131SBrad Bishop getphosphor::dbus::monitoring::ConfigMeta360e7df131SBrad Bishop static auto& get() 370e7df131SBrad Bishop { 380e7df131SBrad Bishop static const Meta meta = 390e7df131SBrad Bishop { 400e7df131SBrad Bishop % for m in meta: 410e7df131SBrad Bishop "${m.name}"s, 420e7df131SBrad Bishop % endfor 430e7df131SBrad Bishop }; 440e7df131SBrad Bishop return meta; 450e7df131SBrad Bishop } 460e7df131SBrad Bishop }; 470e7df131SBrad Bishop 480e7df131SBrad Bishop struct ConfigPaths 490e7df131SBrad Bishop { 500e7df131SBrad Bishop using Paths = std::array<std::string, ${len(paths)}>; 510e7df131SBrad Bishop getphosphor::dbus::monitoring::ConfigPaths520e7df131SBrad Bishop static auto& get() 530e7df131SBrad Bishop { 540e7df131SBrad Bishop static const Paths paths = 550e7df131SBrad Bishop { 560e7df131SBrad Bishop % for p in paths: 570e7df131SBrad Bishop "${p.name}"s, 580e7df131SBrad Bishop % endfor 590e7df131SBrad Bishop }; 600e7df131SBrad Bishop return paths; 610e7df131SBrad Bishop } 620e7df131SBrad Bishop }; 63e73b2c35SBrad Bishop 64e73b2c35SBrad Bishop struct ConfigInterfaces 65e73b2c35SBrad Bishop { 66e73b2c35SBrad Bishop using Interfaces = std::array<std::string, ${len(interfaces)}>; 67e73b2c35SBrad Bishop getphosphor::dbus::monitoring::ConfigInterfaces68e73b2c35SBrad Bishop static auto& get() 69e73b2c35SBrad Bishop { 70e73b2c35SBrad Bishop static const Interfaces interfaces = 71e73b2c35SBrad Bishop { 72e73b2c35SBrad Bishop % for i in interfaces: 73e73b2c35SBrad Bishop "${i.name}"s, 74e73b2c35SBrad Bishop % endfor 75e73b2c35SBrad Bishop }; 76e73b2c35SBrad Bishop return interfaces; 77e73b2c35SBrad Bishop } 78e73b2c35SBrad Bishop }; 79e73b2c35SBrad Bishop 8080c70610SMarri Devender Rao struct ConfigIntfAddPaths 8180c70610SMarri Devender Rao { 8280c70610SMarri Devender Rao using Paths = std::array<std::string, ${len(pathinstances)}>; 8380c70610SMarri Devender Rao getphosphor::dbus::monitoring::ConfigIntfAddPaths8480c70610SMarri Devender Rao static auto& get() 8580c70610SMarri Devender Rao { 8680c70610SMarri Devender Rao static const Paths paths = 8780c70610SMarri Devender Rao { 8880c70610SMarri Devender Rao % for p in pathinstances: 8980c70610SMarri Devender Rao "${p.path}"s, 9080c70610SMarri Devender Rao % endfor 9180c70610SMarri Devender Rao }; 9280c70610SMarri Devender Rao return paths; 9380c70610SMarri Devender Rao } 9480c70610SMarri Devender Rao }; 9580c70610SMarri Devender Rao 96e73b2c35SBrad Bishop struct ConfigProperties 97e73b2c35SBrad Bishop { 98e73b2c35SBrad Bishop using Properties = std::array<std::string, ${len(propertynames)}>; 99e73b2c35SBrad Bishop getphosphor::dbus::monitoring::ConfigProperties100e73b2c35SBrad Bishop static auto& get() 101e73b2c35SBrad Bishop { 102e73b2c35SBrad Bishop static const Properties properties = 103e73b2c35SBrad Bishop { 104e73b2c35SBrad Bishop % for p in propertynames: 105e73b2c35SBrad Bishop "${p.name}"s, 106e73b2c35SBrad Bishop % endfor 107e73b2c35SBrad Bishop }; 108e73b2c35SBrad Bishop return properties; 109e73b2c35SBrad Bishop } 110e73b2c35SBrad Bishop }; 1114b916f13SBrad Bishop 1124b916f13SBrad Bishop struct ConfigPropertyStorage 1134b916f13SBrad Bishop { 114*26dc0bcbSPatrick Williams using Storage = std::array<std::tuple<std::any, std::any>, ${len(instances)}>; 1154b916f13SBrad Bishop getphosphor::dbus::monitoring::ConfigPropertyStorage1164b916f13SBrad Bishop static auto& get() 1174b916f13SBrad Bishop { 1184b916f13SBrad Bishop static Storage storage; 1194b916f13SBrad Bishop return storage; 1204b916f13SBrad Bishop } 1214b916f13SBrad Bishop }; 1224b916f13SBrad Bishop 123efe0158cSMatthew Barth struct ConfigPropertyFilters 124efe0158cSMatthew Barth { 125efe0158cSMatthew Barth using PropertyFilters = std::array<std::unique_ptr<Filters>, ${len(filters)}>; 126efe0158cSMatthew Barth getphosphor::dbus::monitoring::ConfigPropertyFilters127efe0158cSMatthew Barth static auto& get() 128efe0158cSMatthew Barth { 129efe0158cSMatthew Barth static const PropertyFilters propertyFilters = 130efe0158cSMatthew Barth { 131efe0158cSMatthew Barth % for f in filters: 132efe0158cSMatthew Barth std::make_unique<OperandFilters<${f.datatype}>>( 133efe0158cSMatthew Barth std::vector<std::function<bool(${f.datatype})>>{ 134efe0158cSMatthew Barth % for o in f.filters: 135efe0158cSMatthew Barth [](const auto& val){ 136efe0158cSMatthew Barth return val ${o.op} ${o.argument(loader, indent=indent +1)}; 137efe0158cSMatthew Barth }, 138efe0158cSMatthew Barth % endfor 139efe0158cSMatthew Barth } 140efe0158cSMatthew Barth ), 141efe0158cSMatthew Barth % endfor 142efe0158cSMatthew Barth }; 143efe0158cSMatthew Barth return propertyFilters; 144efe0158cSMatthew Barth } 145efe0158cSMatthew Barth }; 146efe0158cSMatthew Barth 1474b916f13SBrad Bishop struct ConfigPropertyIndicies 1484b916f13SBrad Bishop { 1494b916f13SBrad Bishop using PropertyIndicies = std::array<PropertyIndex, ${len(instancegroups)}>; 1504b916f13SBrad Bishop getphosphor::dbus::monitoring::ConfigPropertyIndicies1514b916f13SBrad Bishop static auto& get() 1524b916f13SBrad Bishop { 1534b916f13SBrad Bishop static const PropertyIndicies propertyIndicies = 1544b916f13SBrad Bishop { 1554b916f13SBrad Bishop { 1564b916f13SBrad Bishop % for g in instancegroups: 1574b916f13SBrad Bishop { 1584b916f13SBrad Bishop % for i in g.members: 1594b916f13SBrad Bishop { 1604b916f13SBrad Bishop PropertyIndex::key_type 1614b916f13SBrad Bishop { 1621ada93beSBrad Bishop ConfigPaths::get()[${i[0]}], 1631ada93beSBrad Bishop ConfigInterfaces::get()[${i[2]}], 1641ada93beSBrad Bishop ConfigProperties::get()[${i[3]}] 1654b916f13SBrad Bishop }, 1664b916f13SBrad Bishop PropertyIndex::mapped_type 1674b916f13SBrad Bishop { 1681ada93beSBrad Bishop ConfigMeta::get()[${i[1]}], 1691ada93beSBrad Bishop ConfigMeta::get()[${i[4]}], 1701ada93beSBrad Bishop ConfigPropertyStorage::get()[${i[5]}] 1714b916f13SBrad Bishop }, 1724b916f13SBrad Bishop }, 1734b916f13SBrad Bishop % endfor 1744b916f13SBrad Bishop }, 1754b916f13SBrad Bishop % endfor 1764b916f13SBrad Bishop } 1774b916f13SBrad Bishop }; 1784b916f13SBrad Bishop return propertyIndicies; 1794b916f13SBrad Bishop } 1804b916f13SBrad Bishop }; 1814b916f13SBrad Bishop 18249e66175SBrad Bishop struct ConfigPropertyCallbackGroups 18349e66175SBrad Bishop { 18449e66175SBrad Bishop using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>; getphosphor::dbus::monitoring::ConfigPropertyCallbackGroups18549e66175SBrad Bishop static auto& get() 18649e66175SBrad Bishop { 18749e66175SBrad Bishop static const CallbackGroups propertyCallbackGraph = 18849e66175SBrad Bishop { 18949e66175SBrad Bishop { 19049e66175SBrad Bishop % for g in callbackgroups: 19149e66175SBrad Bishop {${', '.join([str(x) for x in g.members])}}, 19249e66175SBrad Bishop % endfor 19349e66175SBrad Bishop } 19449e66175SBrad Bishop }; 19549e66175SBrad Bishop return propertyCallbackGraph; 19649e66175SBrad Bishop } 19749e66175SBrad Bishop }; 19849e66175SBrad Bishop 1994041d720SBrad Bishop struct ConfigConditions 2004041d720SBrad Bishop { 2014041d720SBrad Bishop using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>; 2024041d720SBrad Bishop getphosphor::dbus::monitoring::ConfigConditions2034041d720SBrad Bishop static auto& get() 2044041d720SBrad Bishop { 2054041d720SBrad Bishop static const Conditions propertyConditions = 2064041d720SBrad Bishop { 2074041d720SBrad Bishop % for c in conditions: 2084041d720SBrad Bishop ${c.construct(loader, indent=indent +3)}, 2094041d720SBrad Bishop % endfor 2104041d720SBrad Bishop }; 2114041d720SBrad Bishop return propertyConditions; 2124041d720SBrad Bishop } 2134041d720SBrad Bishop }; 2144041d720SBrad Bishop 215c1283ae8SBrad Bishop struct ConfigPropertyCallbacks 216c1283ae8SBrad Bishop { 217c1283ae8SBrad Bishop using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>; 218c1283ae8SBrad Bishop getphosphor::dbus::monitoring::ConfigPropertyCallbacks219c1283ae8SBrad Bishop static auto& get() 220c1283ae8SBrad Bishop { 221c1283ae8SBrad Bishop static const Callbacks propertyCallbacks = 222c1283ae8SBrad Bishop { 223c1283ae8SBrad Bishop % for c in callbacks: 224c1283ae8SBrad Bishop ${c.construct(loader, indent=indent +3)}, 225c1283ae8SBrad Bishop % endfor 226c1283ae8SBrad Bishop }; 227c1283ae8SBrad Bishop return propertyCallbacks; 228c1283ae8SBrad Bishop } 229c1283ae8SBrad Bishop }; 230c1283ae8SBrad Bishop 23180c70610SMarri Devender Rao struct ConfigPathCallbacks 23280c70610SMarri Devender Rao { 23380c70610SMarri Devender Rao using Callbacks = std::array<std::unique_ptr<Callback>, ${len(pathcallbacks)}>; 23480c70610SMarri Devender Rao getphosphor::dbus::monitoring::ConfigPathCallbacks23580c70610SMarri Devender Rao static auto& get() 23680c70610SMarri Devender Rao { 23780c70610SMarri Devender Rao static const Callbacks pathCallbacks = 23880c70610SMarri Devender Rao { 23980c70610SMarri Devender Rao % for c in pathcallbacks: 24080c70610SMarri Devender Rao ${c.construct(loader, indent=indent +3)}, 24180c70610SMarri Devender Rao % endfor 24280c70610SMarri Devender Rao }; 24380c70610SMarri Devender Rao return pathCallbacks; 24480c70610SMarri Devender Rao } 24580c70610SMarri Devender Rao }; 24680c70610SMarri Devender Rao 2474b916f13SBrad Bishop struct ConfigPropertyWatches 2484b916f13SBrad Bishop { 2494b916f13SBrad Bishop using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>; 2504b916f13SBrad Bishop getphosphor::dbus::monitoring::ConfigPropertyWatches2514b916f13SBrad Bishop static auto& get() 2524b916f13SBrad Bishop { 2534b916f13SBrad Bishop static const PropertyWatches propertyWatches = 2544b916f13SBrad Bishop { 2554b916f13SBrad Bishop % for w in watches: 2564b916f13SBrad Bishop std::make_unique<PropertyWatchOfType<${w.datatype}, SDBusPlus>>( 257fccdc39fSBrad Bishop % if w.callback is None: 258efe0158cSMatthew Barth % if w.filters is None: 2594b916f13SBrad Bishop ConfigPropertyIndicies::get()[${w.instances}]), 260fccdc39fSBrad Bishop % else: 261fccdc39fSBrad Bishop ConfigPropertyIndicies::get()[${w.instances}], 26298d6462aSLei YU ${w.ignore_start_callback}, 263efe0158cSMatthew Barth ConfigPropertyFilters::get()[${w.filters}].get()), 264efe0158cSMatthew Barth % endif 265efe0158cSMatthew Barth % else: 266efe0158cSMatthew Barth % if w.filters is None: 267efe0158cSMatthew Barth ConfigPropertyIndicies::get()[${w.instances}], 26898d6462aSLei YU *ConfigPropertyCallbacks::get()[${w.callback}], 26998d6462aSLei YU ${w.ignore_start_callback}), 270efe0158cSMatthew Barth % else: 271efe0158cSMatthew Barth ConfigPropertyIndicies::get()[${w.instances}], 272efe0158cSMatthew Barth *ConfigPropertyCallbacks::get()[${w.callback}], 27398d6462aSLei YU ${w.ignore_start_callback}, 274efe0158cSMatthew Barth ConfigPropertyFilters::get()[${w.filters}].get()), 275efe0158cSMatthew Barth % endif 276fccdc39fSBrad Bishop % endif 2774b916f13SBrad Bishop % endfor 2784b916f13SBrad Bishop }; 2794b916f13SBrad Bishop return propertyWatches; 2804b916f13SBrad Bishop } 2814b916f13SBrad Bishop }; 28280c70610SMarri Devender Rao 28380c70610SMarri Devender Rao struct ConfigPathWatches 28480c70610SMarri Devender Rao { 28580c70610SMarri Devender Rao using PathWatches = std::array<std::unique_ptr<Watch>, ${len(pathwatches)}>; 28680c70610SMarri Devender Rao 28780c70610SMarri Devender Rao static auto& get() 28880c70610SMarri Devender Rao { 28980c70610SMarri Devender Rao static const PathWatches pathWatches = 29080c70610SMarri Devender Rao { 29180c70610SMarri Devender Rao % for w in pathwatches: 29280c70610SMarri Devender Rao std::make_unique<PathWatch<SDBusPlus>>( 29380c70610SMarri Devender Rao % if w.pathcallback is None: 29480c70610SMarri Devender Rao ConfigIntfAddPaths::get()[${w.pathinstances}]), 29580c70610SMarri Devender Rao % else: 29680c70610SMarri Devender Rao ConfigIntfAddPaths::get()[${w.pathinstances}], 29780c70610SMarri Devender Rao *ConfigPathCallbacks::get()[${w.pathcallback}]), 29880c70610SMarri Devender Rao % endif 29980c70610SMarri Devender Rao % endfor 30080c70610SMarri Devender Rao }; 30180c70610SMarri Devender Rao return pathWatches; 30280c70610SMarri Devender Rao } 30380c70610SMarri Devender Rao }; 304870c3fc6SBrad Bishop } // namespace monitoring 305870c3fc6SBrad Bishop } // namespace dbus 306870c3fc6SBrad Bishop } // namespace phosphor 307