15
15
#ifndef RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_SUPPORT_HPP_
16
16
#define RCLCPP__DYNAMIC_TYPESUPPORT__DYNAMIC_MESSAGE_TYPE_SUPPORT_HPP_
17
17
18
+ #include < rcl/allocator.h>
19
+
18
20
#include < rosidl_dynamic_typesupport/dynamic_message_type_support_struct.h>
19
21
#include < rosidl_dynamic_typesupport/types.h>
20
22
#include < rosidl_runtime_c/message_type_support_struct.h>
30
32
#include " rclcpp/macros.hpp"
31
33
#include " rclcpp/visibility_control.hpp"
32
34
33
-
34
35
namespace rclcpp
35
36
{
36
37
namespace dynamic_typesupport
@@ -44,7 +45,7 @@ namespace dynamic_typesupport
44
45
* support struct, instead of `rcl_dynamic_message_type_support_handle_create()`,
45
46
* because this class will manage the lifetimes for you.
46
47
*
47
- * Do NOT call rcl_dynamic_message_type_support_handle_destroy !!
48
+ * Do NOT call rcl_dynamic_message_type_support_handle_fini !!
48
49
*
49
50
* This class:
50
51
* - Manages the lifetime of the raw pointer.
@@ -68,16 +69,17 @@ class DynamicMessageTypeSupport : public std::enable_shared_from_this<DynamicMes
68
69
RCLCPP_PUBLIC
69
70
DynamicMessageTypeSupport (
70
71
const rosidl_runtime_c__type_description__TypeDescription & description,
71
- const std::string & serialization_library_name = " " );
72
+ const std::string & serialization_library_name = " " ,
73
+ rcl_allocator_t allocator = rcl_get_default_allocator());
72
74
73
75
// / From description, for provided serialization support
74
76
// / Does NOT take ownership of the description (copies instead.)
75
- // / Constructs type support top-down (calling
76
- // / `rosidl_dynamic_message_type_support_handle_create()`)
77
+ // / Constructs type support top-down (calling `rosidl_dynamic_message_type_support_handle_init()`)
77
78
RCLCPP_PUBLIC
78
79
DynamicMessageTypeSupport (
79
80
DynamicSerializationSupport::SharedPtr serialization_support,
80
- const rosidl_runtime_c__type_description__TypeDescription & description);
81
+ const rosidl_runtime_c__type_description__TypeDescription & description,
82
+ rcl_allocator_t allocator = rcl_get_default_allocator());
81
83
82
84
// / Assume ownership of managed types
83
85
// / Does NOT take ownership of the description (copies instead.)
@@ -93,7 +95,8 @@ class DynamicMessageTypeSupport : public std::enable_shared_from_this<DynamicMes
93
95
DynamicSerializationSupport::SharedPtr serialization_support,
94
96
DynamicMessageType::SharedPtr dynamic_message_type,
95
97
DynamicMessage::SharedPtr dynamic_message,
96
- const rosidl_runtime_c__type_description__TypeDescription & description);
98
+ const rosidl_runtime_c__type_description__TypeDescription & description,
99
+ rcl_allocator_t allocator = rcl_get_default_allocator());
97
100
98
101
RCLCPP_PUBLIC
99
102
virtual ~DynamicMessageTypeSupport ();
@@ -102,40 +105,20 @@ class DynamicMessageTypeSupport : public std::enable_shared_from_this<DynamicMes
102
105
// GETTERS =======================================================================================
103
106
RCLCPP_PUBLIC
104
107
const std::string
105
- get_library_identifier () const ;
106
-
107
- RCLCPP_PUBLIC
108
- rosidl_message_type_support_t *
109
- get_rosidl_message_type_support ();
110
-
111
- RCLCPP_PUBLIC
112
- const rosidl_message_type_support_t *
113
- get_rosidl_message_type_support () const ;
108
+ get_serialization_library_identifier () const ;
114
109
115
110
RCLCPP_PUBLIC
116
- std::shared_ptr< rosidl_message_type_support_t >
117
- get_shared_rosidl_message_type_support ();
111
+ const rosidl_message_type_support_t &
112
+ get_const_rosidl_message_type_support ();
118
113
119
114
RCLCPP_PUBLIC
120
- std::shared_ptr< const rosidl_message_type_support_t >
121
- get_shared_rosidl_message_type_support () const ;
115
+ const rosidl_message_type_support_t &
116
+ get_const_rosidl_message_type_support () const ;
122
117
123
118
RCLCPP_PUBLIC
124
- rosidl_runtime_c__type_description__TypeDescription *
125
- get_rosidl_runtime_c_type_description ();
126
-
127
- RCLCPP_PUBLIC
128
- const rosidl_runtime_c__type_description__TypeDescription *
119
+ const rosidl_runtime_c__type_description__TypeDescription &
129
120
get_rosidl_runtime_c_type_description () const ;
130
121
131
- RCLCPP_PUBLIC
132
- std::shared_ptr<rosidl_runtime_c__type_description__TypeDescription>
133
- get_shared_rosidl_runtime_c_type_description ();
134
-
135
- RCLCPP_PUBLIC
136
- std::shared_ptr<const rosidl_runtime_c__type_description__TypeDescription>
137
- get_shared_rosidl_runtime_c_type_description () const ;
138
-
139
122
RCLCPP_PUBLIC
140
123
DynamicSerializationSupport::SharedPtr
141
124
get_shared_dynamic_serialization_support ();
@@ -163,42 +146,21 @@ class DynamicMessageTypeSupport : public std::enable_shared_from_this<DynamicMes
163
146
protected:
164
147
RCLCPP_DISABLE_COPY (DynamicMessageTypeSupport)
165
148
166
- DynamicSerializationSupport::SharedPtr serialization_support_;
167
- DynamicMessageType::SharedPtr dynamic_message_type_;
168
- DynamicMessage::SharedPtr dynamic_message_;
169
- std::shared_ptr<rosidl_runtime_c__type_description__TypeDescription> description_;
170
-
171
- std::shared_ptr<rosidl_message_type_support_t > rosidl_message_type_support_;
149
+ RCLCPP_PUBLIC
150
+ rosidl_message_type_support_t &
151
+ get_rosidl_message_type_support ();
172
152
173
153
private:
174
154
RCLCPP_PUBLIC
175
155
DynamicMessageTypeSupport ();
176
156
177
- RCLCPP_PUBLIC
178
- void
179
- manage_description_ (rosidl_runtime_c__type_description__TypeDescription * description);
180
-
181
- RCLCPP_PUBLIC
182
- void
183
- init_dynamic_message_type_ (
184
- DynamicSerializationSupport::SharedPtr serialization_support,
185
- const rosidl_runtime_c__type_description__TypeDescription * description);
186
-
187
- RCLCPP_PUBLIC
188
- void
189
- init_dynamic_message_ (DynamicMessageType::SharedPtr dynamic_type);
157
+ DynamicSerializationSupport::SharedPtr serialization_support_;
158
+ DynamicMessageType::SharedPtr dynamic_message_type_;
159
+ DynamicMessage::SharedPtr dynamic_message_;
190
160
191
- // By aggregation
192
- RCLCPP_PUBLIC
193
- void
194
- init_rosidl_message_type_support_ (
195
- DynamicSerializationSupport::SharedPtr serialization_support,
196
- DynamicMessageType::SharedPtr dynamic_message_type,
197
- DynamicMessage::SharedPtr dynamic_message,
198
- rosidl_runtime_c__type_description__TypeDescription * description);
161
+ rosidl_message_type_support_t rosidl_message_type_support_;
199
162
};
200
163
201
-
202
164
} // namespace dynamic_typesupport
203
165
} // namespace rclcpp
204
166
0 commit comments