mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 06:36:45 +08:00
ucdr/msg.h.em: static inline the (de-)serialization methods
to avoid multiple definitions when using them from different places.
This commit is contained in:
@@ -124,7 +124,7 @@ static inline constexpr int ucdr_topic_size_@(topic)()
|
|||||||
return @(struct_size);
|
return @(struct_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ucdr_serialize_@(topic)(const void* data, ucdrBuffer& buf, int64_t time_offset = 0)
|
static inline bool ucdr_serialize_@(topic)(const void* data, ucdrBuffer& buf, int64_t time_offset = 0)
|
||||||
{
|
{
|
||||||
const @(uorb_struct)& topic = *static_cast<const @(uorb_struct)*>(data);
|
const @(uorb_struct)& topic = *static_cast<const @(uorb_struct)*>(data);
|
||||||
@{
|
@{
|
||||||
@@ -153,7 +153,7 @@ for field_type, field_name, field_size, padding in fields:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ucdr_deserialize_@(topic)(ucdrBuffer& buf, @(uorb_struct)& topic, int64_t time_offset = 0)
|
static inline bool ucdr_deserialize_@(topic)(ucdrBuffer& buf, @(uorb_struct)& topic, int64_t time_offset = 0)
|
||||||
{
|
{
|
||||||
@{
|
@{
|
||||||
for field_type, field_name, field_size, padding in fields:
|
for field_type, field_name, field_size, padding in fields:
|
||||||
|
|||||||
Reference in New Issue
Block a user