114c4797cSPatrick Williams#include <nlohmann/json.hpp> 2*b08d14ddSPatrick Williams#include <sdbusplus/sdbuspp_support/event.hpp> 3*b08d14ddSPatrick Williams#include <${events.headerFile("event")}> 4*b08d14ddSPatrick Williams#include <iostream> 514c4797cSPatrick Williams%if events.errors: 614c4797cSPatrick Williams 714c4797cSPatrick Williamsnamespace sdbusplus::error::${events.cppNamespacedClass()} 814c4797cSPatrick Williams{ 914c4797cSPatrick Williams% for e in events.errors: 1014c4797cSPatrick Williams 1114c4797cSPatrick Williams${events.render(loader, "event.cpp.mako", events=events, event=e)}\ 1214c4797cSPatrick Williams% endfor 1314c4797cSPatrick Williams 1400fd0a8bSPatrick Williams/* Load error map into sd_bus for errno translation. */ 1500fd0a8bSPatrick Williamsstatic sd_bus_error_map errors[] = { 1600fd0a8bSPatrick Williams% for e in events.errors: 1700fd0a8bSPatrick Williams SD_BUS_ERROR_MAP(${e.CamelCase}::errName, ${e.CamelCase}::errErrno), 1800fd0a8bSPatrick Williams% endfor 1900fd0a8bSPatrick Williams SD_BUS_ERROR_MAP_END 2000fd0a8bSPatrick Williams}; 2100fd0a8bSPatrick Williams[[gnu::constructor]] static void loadErrors() 2200fd0a8bSPatrick Williams{ 2300fd0a8bSPatrick Williams sd_bus_error_add_map(errors); 2400fd0a8bSPatrick Williams} 2500fd0a8bSPatrick Williams 2614c4797cSPatrick Williams} // namespace sdbusplus::error::${events.cppNamespacedClass()} 2700fd0a8bSPatrick Williams 2814c4797cSPatrick Williams%endif 299213e158SPatrick Williams%if events.events: 3014c4797cSPatrick Williams 3114c4797cSPatrick Williamsnamespace sdbusplus::event::${events.cppNamespacedClass()} 3214c4797cSPatrick Williams{ 3314c4797cSPatrick Williams% for e in events.events: 3414c4797cSPatrick Williams 3514c4797cSPatrick Williams${events.render(loader, "event.cpp.mako", events=events, event=e)}\ 3614c4797cSPatrick Williams% endfor 3714c4797cSPatrick Williams 3814c4797cSPatrick Williams} // namespace sdbusplus::event::${events.cppNamespacedClass()} 3914c4797cSPatrick Williams%endif 40