1struct ${event.CamelCase} final : 2 public sdbusplus::exception::generated_event<${event.CamelCase}> 3{ 4 ${event.CamelCase}(const nlohmann::json&, const std::source_location&); 5%if len(event.metadata) == 0: 6 ${event.CamelCase}( 7 const std::source_location& source = std::source_location::current()) : 8 source_file(source.file_name()), source_func(source.function_name()), 9 source_line(source.line()), source_column(source.column()), 10 pid(getpid()) 11 {} 12%else: 13 ${event.CamelCase}( 14 ${", ".join([ 15 f"metadata_t<\"{m.SNAKE_CASE}\">, {m.cppTypeParam(events.name)} {m.camelCase}_" 16 for m in event.metadata ])}, 17 const std::source_location& source = std::source_location::current()) : 18 ${", ".join([ 19 f"{m.camelCase}({m.camelCase}_)" for m in event.metadata ])}, 20 source_file(source.file_name()), source_func(source.function_name()), 21 source_line(source.line()), source_column(source.column()), 22 pid(getpid()) 23 {} 24 25%for m in event.metadata: 26 ${m.cppTypeParam(events.name)} ${m.camelCase}; 27%endfor 28 29%endif 30 int set_error(sd_bus_error*) const override; 31 int set_error(SdBusInterface*, sd_bus_error*) const override; 32 auto to_json() const -> nlohmann::json override; 33 34 std::string source_file; 35 std::string source_func; 36 size_t source_line; 37 size_t source_column; 38 pid_t pid; 39 40 static constexpr auto errName = 41 "${events.name}.${event.name}"; 42 static constexpr auto errDesc = 43 "${event.description}"; 44 static constexpr auto errWhat = 45 "${events.name}.${event.name}: ${event.description}"; 46 static constexpr int errSeverity = ${event.severity}; 47 48 static constexpr auto errErrno = ${event.errno}; 49}; 50 51namespace details 52{ 53void register_${event.CamelCase}(); 54[[gnu::constructor]] inline void force_register_${event.CamelCase}() 55{ 56 register_${event.CamelCase}(); 57} 58} // namespace details 59