Skip to content

Commit

Permalink
Backport null defaults support to humble
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <ryan.friedman@avinc.com>
  • Loading branch information
Ryan Friedman committed Sep 7, 2024
1 parent 65140bd commit 24aeed3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions rosidl_generator_cpp/resource/idl__builder.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include_directives = set()
#include <algorithm>
#include <utility>
#include <limits>
#include "@(include_base)__struct.hpp"
#include "rosidl_runtime_cpp/message_initialization.hpp"
Expand Down
1 change: 1 addition & 0 deletions rosidl_generator_cpp/resource/idl__struct.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ include_directives = set()
#include <memory>
#include <string>
#include <vector>
// foobar
#include "rosidl_runtime_cpp/bounded_vector.hpp"
#include "rosidl_runtime_cpp/message_initialization.hpp"
Expand Down
9 changes: 9 additions & 0 deletions rosidl_generator_cpp/resource/msg__struct.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ for member in message.structure.members:
@[end if]@
@#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#include <math.h>
#include <limits>

@{
deprecated_macro_name = \
'__'.join(['DEPRECATED', package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name])
Expand Down Expand Up @@ -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]@
Expand Down

0 comments on commit 24aeed3

Please sign in to comment.