@@ -96,44 +96,22 @@ extract_type_identifier(const std::string & full_type)
9696namespace internal
9797{
9898
99- SymbolNameErrorFuncPair get_typesupport_symbol_name (
99+ static SymbolNameErrorFuncPair _get_typesupport_symbol_name_impl (
100100 const std::string & type,
101101 const std::string & typesupport_identifier,
102- TypeSupport type_support)
102+ const std::string & typesupport_name,
103+ const std::string & symbol_part_name,
104+ const std::string & middle_module_additional)
103105{
104106 std::string package_name;
105107 std::string middle_module;
106108 std::string type_name;
107109 std::tie (package_name, middle_module, type_name) = extract_type_identifier (type);
108110
109- std::string typesupport_name;
110- std::string symbol_part_name;
111- switch (type_support) {
112- case TypeSupport::MESSAGE:
113- typesupport_name = " message" ;
114- symbol_part_name = " __get_message_type_support_handle__" ;
115- if (middle_module.empty ()) {
116- middle_module = " msg" ;
117- }
118- break ;
119- case TypeSupport::SERVICE:
120- typesupport_name = " service" ;
121- symbol_part_name = " __get_service_type_support_handle__" ;
122- if (middle_module.empty ()) {
123- middle_module = " srv" ;
124- }
125- break ;
126- case TypeSupport::ACTION:
127- typesupport_name = " action" ;
128- symbol_part_name = " __get_action_type_support_handle__" ;
129- if (middle_module.empty ()) {
130- middle_module = " action" ;
131- }
132- break ;
133- default :
134- typesupport_name = " unknown" ;
135- break ;
111+ if (middle_module.empty ()) {
112+ middle_module = middle_module_additional;
136113 }
114+
137115 auto mk_error = [&package_name, &type_name, &typesupport_name]() {
138116 std::stringstream rcutils_dynamic_loading_error;
139117 rcutils_dynamic_loading_error <<
@@ -149,6 +127,48 @@ SymbolNameErrorFuncPair get_typesupport_symbol_name(
149127 return {std::move (symbol_name), std::move (mk_error)};
150128}
151129
130+ SymbolNameErrorFuncPair _get_typesupport_symbol_name (
131+ const std::string & type,
132+ const std::string & typesupport_identifier,
133+ typesupport_message_tag)
134+ {
135+ std::string typesupport_name = " message" ;
136+ std::string symbol_part_name = " __get_message_type_support_handle__" ;
137+ std::string middle_module_additional = " msg" ;
138+
139+ return _get_typesupport_symbol_name_impl (
140+ type, typesupport_identifier, typesupport_name, symbol_part_name, middle_module_additional
141+ );
142+ }
143+
144+ SymbolNameErrorFuncPair _get_typesupport_symbol_name (
145+ const std::string & type,
146+ const std::string & typesupport_identifier,
147+ typesupport_service_tag)
148+ {
149+ std::string typesupport_name = " service" ;
150+ std::string symbol_part_name = " __get_service_type_support_handle__" ;
151+ std::string middle_module_additional = " srv" ;
152+
153+ return _get_typesupport_symbol_name_impl (
154+ type, typesupport_identifier, typesupport_name, symbol_part_name, middle_module_additional
155+ );
156+ }
157+
158+ SymbolNameErrorFuncPair _get_typesupport_symbol_name (
159+ const std::string & type,
160+ const std::string & typesupport_identifier,
161+ typesupport_action_tag)
162+ {
163+ std::string typesupport_name = " action" ;
164+ std::string symbol_part_name = " __get_action_type_support_handle__" ;
165+ std::string middle_module_additional = " action" ;
166+
167+ return _get_typesupport_symbol_name_impl (
168+ type, typesupport_identifier, typesupport_name, symbol_part_name, middle_module_additional
169+ );
170+ }
171+
152172} // namespace internal
153173
154174std::shared_ptr<rcpputils::SharedLibrary>
0 commit comments