Add type_id templates
C++ templates to assist in type conversions between C++
types and dbus types. These templates provide a compile-time
conversion between built-in types and a C-string of dbus types.
Example:
uint32_t a = 0;
const char* b = "a string";
auto t = sdbusplus::message::types::type_id(a, b);
This results in a tuple equal to std::make_tuple('u','s', '\0')', which
can be converted to a C-string("us") by tuple_to_array.
In a subsequent commit this interface will be used to do a
compile-time transformation from something like:
msg->append(a, b)
To:
sd_bus_message_append(msg, "us", a, b);
The type_id template can be extended to support tuples, STL
containers, and user-defined types as needed.
Change-Id: I913501b51ffc24bcf4219f4297a1e0f8ebed97b5
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2 files changed