sdbus++: generate callback methods for server bindings
Create sd-bus message handler methods as callbacks for object
method calls. These generated callbacks will extract the
parameters from the message, call the virtual-method implementation,
and pack the response into a method-return message, which is sent
back to the caller.
Change-Id: Ia3872bbbbfdb57375a1ffdde7e64296271cdd532
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/templates/interface.mako.server.cpp b/tools/templates/interface.mako.server.cpp
new file mode 100644
index 0000000..16f7f43
--- /dev/null
+++ b/tools/templates/interface.mako.server.cpp
@@ -0,0 +1,24 @@
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/message.hpp>
+#include <${"/".join(interface.name.split('.') + [ 'server.hpp' ])}>
+ <%
+ namespaces = interface.name.split('.')
+ classname = namespaces.pop()
+ %>
+namespace sdbusplus
+{
+namespace server
+{
+ % for s in namespaces:
+namespace ${s}
+{
+ % endfor
+ % for m in interface.methods:
+${ m.cpp_prototype(loader, interface=interface, ptype='callback-cpp') }
+ % endfor
+
+ % for s in namespaces:
+} // namespace ${s}
+ % endfor
+} // namespace server
+} // namespace sdbusplus