114c4797cSPatrick Williams#include <${events.headerFile("event")}>
214c4797cSPatrick Williams#include <nlohmann/json.hpp>
314c4797cSPatrick Williams
414c4797cSPatrick Williams%if events.errors:
514c4797cSPatrick Williams
614c4797cSPatrick Williamsnamespace sdbusplus::error::${events.cppNamespacedClass()}
714c4797cSPatrick Williams{
814c4797cSPatrick Williams% for e in events.errors:
914c4797cSPatrick Williams
1014c4797cSPatrick Williams${events.render(loader, "event.cpp.mako", events=events, event=e)}\
1114c4797cSPatrick Williams% endfor
1214c4797cSPatrick Williams
1300fd0a8bSPatrick Williams/* Load error map into sd_bus for errno translation. */
1400fd0a8bSPatrick Williamsstatic sd_bus_error_map errors[] = {
1500fd0a8bSPatrick Williams% for e in events.errors:
1600fd0a8bSPatrick Williams    SD_BUS_ERROR_MAP(${e.CamelCase}::errName, ${e.CamelCase}::errErrno),
1700fd0a8bSPatrick Williams% endfor
1800fd0a8bSPatrick Williams    SD_BUS_ERROR_MAP_END
1900fd0a8bSPatrick Williams};
2000fd0a8bSPatrick Williams[[gnu::constructor]] static void loadErrors()
2100fd0a8bSPatrick Williams{
2200fd0a8bSPatrick Williams    sd_bus_error_add_map(errors);
2300fd0a8bSPatrick Williams}
2400fd0a8bSPatrick Williams
2514c4797cSPatrick Williams} // namespace sdbusplus::error::${events.cppNamespacedClass()}
2600fd0a8bSPatrick Williams
2714c4797cSPatrick Williams%endif
28*9213e158SPatrick Williams%if events.events:
2914c4797cSPatrick Williams
3014c4797cSPatrick Williamsnamespace sdbusplus::event::${events.cppNamespacedClass()}
3114c4797cSPatrick Williams{
3214c4797cSPatrick Williams% for e in events.events:
3314c4797cSPatrick Williams
3414c4797cSPatrick Williams${events.render(loader, "event.cpp.mako", events=events, event=e)}\
3514c4797cSPatrick Williams% endfor
3614c4797cSPatrick Williams
3714c4797cSPatrick Williams} // namespace sdbusplus::event::${events.cppNamespacedClass()}
3814c4797cSPatrick Williams%endif
39