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
13*00fd0a8bSPatrick Williams/* Load error map into sd_bus for errno translation. */
14*00fd0a8bSPatrick Williamsstatic sd_bus_error_map errors[] = {
15*00fd0a8bSPatrick Williams% for e in events.errors:
16*00fd0a8bSPatrick Williams    SD_BUS_ERROR_MAP(${e.CamelCase}::errName, ${e.CamelCase}::errErrno),
17*00fd0a8bSPatrick Williams% endfor
18*00fd0a8bSPatrick Williams    SD_BUS_ERROR_MAP_END
19*00fd0a8bSPatrick Williams};
20*00fd0a8bSPatrick Williams[[gnu::constructor]] static void loadErrors()
21*00fd0a8bSPatrick Williams{
22*00fd0a8bSPatrick Williams    sd_bus_error_add_map(errors);
23*00fd0a8bSPatrick Williams}
24*00fd0a8bSPatrick Williams
2514c4797cSPatrick Williams} // namespace sdbusplus::error::${events.cppNamespacedClass()}
26*00fd0a8bSPatrick Williams
2714c4797cSPatrick Williams%endif
2814c4797cSPatrick Williams%if events.errors:
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