1
1
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2
2
// Copyright (c) 2021 by ZhenshengLee. All rights reserved.
3
+ // Copyright (c) 2023 by Apex.AI Inc. All rights reserved.
3
4
//
4
5
// Licensed under the Apache License, Version 2.0 (the "License");
5
6
// you may not use this file except in compliance with the License.
21
22
#include " rcpputils/split.hpp"
22
23
23
24
#include " rosidl_typesupport_cpp/message_type_support.hpp"
25
+ #include " rosidl_typesupport_cpp/service_type_support.hpp"
24
26
25
27
#include " rosidl_typesupport_introspection_c/field_types.h"
26
28
#include " rosidl_typesupport_introspection_c/identifier.h"
@@ -62,6 +64,15 @@ inline void extract_type(
62
64
type_name = rmw_iceoryx_cpp::iceoryx_get_message_name (type_support);
63
65
}
64
66
67
+ inline void extract_type (
68
+ const rosidl_service_type_support_t * type_support,
69
+ std::string & package_name,
70
+ std::string & type_name)
71
+ {
72
+ package_name = to_message_type (rmw_iceoryx_cpp::iceoryx_get_service_namespace (type_support));
73
+ type_name = rmw_iceoryx_cpp::iceoryx_get_service_name (type_support);
74
+ }
75
+
65
76
namespace rmw_iceoryx_cpp
66
77
{
67
78
@@ -159,16 +170,10 @@ get_service_description_from_name_n_type(
159
170
return std::make_tuple (service, instance, event);
160
171
}
161
172
162
- iox::capro::ServiceDescription
163
- get_iceoryx_service_description (
173
+ iox::capro::ServiceDescription make_service_description (
164
174
const std::string & topic_name,
165
- const rosidl_message_type_support_t * type_supports )
175
+ const std::string & type_name )
166
176
{
167
- std::string package_name;
168
- std::string type_name;
169
- extract_type (type_supports, package_name, type_name);
170
- type_name = package_name + " /" + type_name;
171
-
172
177
auto serviceDescriptionTuple = get_service_description_from_name_n_type (topic_name, type_name);
173
178
174
179
return iox::capro::ServiceDescription (
@@ -186,4 +191,30 @@ get_iceoryx_service_description(
186
191
serviceDescriptionTuple))));
187
192
}
188
193
194
+ iox::capro::ServiceDescription
195
+ get_iceoryx_service_description (
196
+ const std::string & topic_name,
197
+ const rosidl_message_type_support_t * type_supports)
198
+ {
199
+ std::string package_name;
200
+ std::string type_name;
201
+ extract_type (type_supports, package_name, type_name);
202
+ type_name = package_name + " /" + type_name;
203
+
204
+ return make_service_description (topic_name, type_name);
205
+ }
206
+
207
+ iox::capro::ServiceDescription
208
+ get_iceoryx_service_description (
209
+ const std::string & topic_name,
210
+ const rosidl_service_type_support_t * type_supports)
211
+ {
212
+ std::string package_name;
213
+ std::string type_name;
214
+ extract_type (type_supports, package_name, type_name);
215
+ type_name = package_name + " /" + type_name;
216
+
217
+ return make_service_description (topic_name, type_name);
218
+ }
219
+
189
220
} // namespace rmw_iceoryx_cpp
0 commit comments