From 24aeed3e2d24036fa443dd483f2d306dabfd21b5 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Thu, 14 Mar 2024 22:20:07 +0000 Subject: [PATCH] Backport null defaults support to humble Signed-off-by: Ryan Friedman --- rosidl_generator_cpp/resource/idl__builder.hpp.em | 1 + rosidl_generator_cpp/resource/idl__struct.hpp.em | 1 + rosidl_generator_cpp/resource/msg__struct.hpp.em | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/rosidl_generator_cpp/resource/idl__builder.hpp.em b/rosidl_generator_cpp/resource/idl__builder.hpp.em index 628bfcae9..e6cdd7bb9 100644 --- a/rosidl_generator_cpp/resource/idl__builder.hpp.em +++ b/rosidl_generator_cpp/resource/idl__builder.hpp.em @@ -29,6 +29,7 @@ include_directives = set() #include #include +#include #include "@(include_base)__struct.hpp" #include "rosidl_runtime_cpp/message_initialization.hpp" diff --git a/rosidl_generator_cpp/resource/idl__struct.hpp.em b/rosidl_generator_cpp/resource/idl__struct.hpp.em index 8f0cfffd3..9c6aa7ebc 100644 --- a/rosidl_generator_cpp/resource/idl__struct.hpp.em +++ b/rosidl_generator_cpp/resource/idl__struct.hpp.em @@ -32,6 +32,7 @@ include_directives = set() #include #include #include +// foobar #include "rosidl_runtime_cpp/bounded_vector.hpp" #include "rosidl_runtime_cpp/message_initialization.hpp" diff --git a/rosidl_generator_cpp/resource/msg__struct.hpp.em b/rosidl_generator_cpp/resource/msg__struct.hpp.em index 90cb9e161..58dcf4f79 100644 --- a/rosidl_generator_cpp/resource/msg__struct.hpp.em +++ b/rosidl_generator_cpp/resource/msg__struct.hpp.em @@ -80,6 +80,9 @@ for member in message.structure.members: @[end if]@ @#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +#include +#include + @{ deprecated_macro_name = \ '__'.join(['DEPRECATED', package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name]) @@ -295,6 +298,12 @@ val = primitive_value_to_cpp(constant.type, constant.value) @[ else]@ @(constant.value)@ @[ end if]; +@[ elif constant.type.typename == 'float' or constant.type.typename == 'double']@ +@{ +from rosidl_generator_cpp import primitive_value_to_cpp +val = primitive_value_to_cpp(constant.type, constant.value) +}@ + @(val); @[ else]@ @(constant.value); @[ end if]@