Skip to content

Commit 24aeed3

Browse files
author
Ryan Friedman
committed
Backport null defaults support to humble
Signed-off-by: Ryan Friedman <[email protected]>
1 parent 65140bd commit 24aeed3

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

rosidl_generator_cpp/resource/idl__builder.hpp.em

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ include_directives = set()
2929
3030
#include <algorithm>
3131
#include <utility>
32+
#include <limits>
3233
3334
#include "@(include_base)__struct.hpp"
3435
#include "rosidl_runtime_cpp/message_initialization.hpp"

rosidl_generator_cpp/resource/idl__struct.hpp.em

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ include_directives = set()
3232
#include <memory>
3333
#include <string>
3434
#include <vector>
35+
// foobar
3536
3637
#include "rosidl_runtime_cpp/bounded_vector.hpp"
3738
#include "rosidl_runtime_cpp/message_initialization.hpp"

rosidl_generator_cpp/resource/msg__struct.hpp.em

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ for member in message.structure.members:
8080
@[end if]@
8181
@#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8282

83+
#include <math.h>
84+
#include <limits>
85+
8386
@{
8487
deprecated_macro_name = \
8588
'__'.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)
295298
@[ else]@
296299
@(constant.value)@
297300
@[ end if];
301+
@[ elif constant.type.typename == 'float' or constant.type.typename == 'double']@
302+
@{
303+
from rosidl_generator_cpp import primitive_value_to_cpp
304+
val = primitive_value_to_cpp(constant.type, constant.value)
305+
}@
306+
@(val);
298307
@[ else]@
299308
@(constant.value);
300309
@[ end if]@

0 commit comments

Comments
 (0)