diff --git a/rosidl_adapter_proto/cmake/rosidl_adapter_proto-extras.cmake.in b/rosidl_adapter_proto/cmake/rosidl_adapter_proto-extras.cmake.in
index 6bf7ad0..90b80e3 100644
--- a/rosidl_adapter_proto/cmake/rosidl_adapter_proto-extras.cmake.in
+++ b/rosidl_adapter_proto/cmake/rosidl_adapter_proto-extras.cmake.in
@@ -29,23 +29,23 @@ else()
"${rosidl_adapter_proto_TEMPLATE_DIR}")
include("${rosidl_adapter_proto_DIR}/rosidl_adapt_proto_interfaces.cmake")
-
+
add_compile_definitions("ROSIDL_ADAPTER_PROTO_BUILDING_DLL__${PROJECT_NAME}")
# There is no clean way to include additional files into protobuf headers
if(NOT WIN32)
add_compile_options("-include${rosidl_adapter_proto_VISIBILITY_CONTROL_HEADER}")
else()
- add_compile_options( "/FI\"${rosidl_adapter_proto_VISIBILITY_CONTROL_HEADER}\"")
+ add_compile_options("/FI\"${rosidl_adapter_proto_VISIBILITY_CONTROL_HEADER}\"")
endif()
-
+
foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
set(_proto_dir "${${_pkg_name}_DIR}/../../../include/${_pkg_name}/${_pkg_name}/rosidl_adapter_proto__visibility_control.h")
normalize_path(_proto_dir "${_proto_dir}")
if(NOT WIN32)
add_compile_options("-include${_proto_dir}")
else()
- add_compile_options( "/FI\"${_proto_dir}\"")
+ add_compile_options("/FI\"${_proto_dir}\"")
endif()
endforeach()
diff --git a/rosidl_adapter_proto/package.xml b/rosidl_adapter_proto/package.xml
index 7b0a027..ad4aac0 100644
--- a/rosidl_adapter_proto/package.xml
+++ b/rosidl_adapter_proto/package.xml
@@ -12,7 +12,7 @@
python3-empy
rosidl_cli
rosidl_parser
-
+
rosidl_interface_packages
diff --git a/rosidl_adapter_proto/rosidl_adapter_proto/__init__.py b/rosidl_adapter_proto/rosidl_adapter_proto/__init__.py
index 5abe056..a76db58 100644
--- a/rosidl_adapter_proto/rosidl_adapter_proto/__init__.py
+++ b/rosidl_adapter_proto/rosidl_adapter_proto/__init__.py
@@ -15,25 +15,25 @@
# limitations under the License.
#
# ================================= Apache 2.0 =================================
-from rosidl_cmake import generate_files
-
-import rosidl_parser.definition as rosidl
import subprocess
import zlib
+from rosidl_cmake import generate_files
+import rosidl_parser.definition as rosidl
+
# A postfix for the protobuf package name / the c++ namespace
-PROTO_PACKAGE_POSTFIX = "pb"
+PROTO_PACKAGE_POSTFIX = 'pb'
# The rpc-function name for service calls. As ros services can only offer a
# single function, this function gets a static name in the protobuf service
-PROTO_SERVICE_CALL_NAME = "Call"
+PROTO_SERVICE_CALL_NAME = 'Call'
# The rpc function name for sending an action goal
-PROTO_ACTION_SEND_GOAL_CALL_NAME = "SendGoal"
+PROTO_ACTION_SEND_GOAL_CALL_NAME = 'SendGoal'
# The rpc function name for retrieving the action result
-PROTO_ACTION_GET_RESULT_CALL_NAME = "GetResult"
+PROTO_ACTION_GET_RESULT_CALL_NAME = 'GetResult'
# A Mapping from IDL -> Protobuf type
MSG_TYPE_TO_PROTO = {
@@ -58,25 +58,33 @@
field_val = 0
+
def compute_proto_field_number(variable_name):
- # Field number rules (https://developers.google.com/protocol-buffers/docs/proto#assigning_field_numbers)
+ # Field number rules (https://developers.google.com/protocol-buffers/docs/
+ # proto#assigning_field_numbers)
#
# Smallest: 1
# Largest: 536870911 (= 2^29 - 1)
#
# Reserved Range: 19000 to 19999 (=> 1000 values)
- field_number = zlib.crc32(bytearray(variable_name, 'utf8')) # Create a 32 bit hash from the variable name
- field_number = (field_number % (536870911 - 1000)) # Reduce to the correct amount of values
- field_number += 1 # Account for the fact that we must not use 0
+ # Create a 32 bit hash from the variable name
+ field_number = zlib.crc32(bytearray(variable_name, 'utf8'))
+ # Reduce to the correct amount of values
+ field_number = (field_number % (536870911 - 1000))
+ # Account for the fact that we must not use 0
+ field_number += 1
+ # Account for the fact that we must not use 19000 to 19999
if field_number >= 19000:
- field_number += 1000 # Account for the fact that we must not use 19000 to 19999
-
+ field_number += 1000
+
return field_number
+
def to_proto_import(namespaced_type):
assert isinstance(namespaced_type, rosidl.NamespacedType)
- return "/".join(namespaced_type.namespaces + [namespaced_type.name]) + ".proto"
+ return '/'.join(namespaced_type.namespaces + [namespaced_type.name]) + '.proto'
+
def collect_proto_imports(rosidl_message):
assert isinstance(rosidl_message, rosidl.Message)
@@ -90,11 +98,12 @@ def collect_proto_imports(rosidl_message):
namespaced_type = member.type.value_type
else:
continue
-
+
import_set.add(to_proto_import(namespaced_type))
return import_set
+
def generate_proto(generator_arguments_file):
mapping = {
'idl.proto.em': '%s.proto',
@@ -102,13 +111,15 @@ def generate_proto(generator_arguments_file):
generate_files(generator_arguments_file, mapping, keep_case=True)
return 0
+
def compile_proto(protoc_path, proto_path_list, cpp_out_dir, proto_files, package_name):
protoc_cmd = [protoc_path]
for path in proto_path_list:
- protoc_cmd.append("--proto_path=" + path)
-
- protoc_cmd.append(f"--cpp_out=dllexport_decl=ROSIDL_ADAPTER_PROTO_PUBLIC__{package_name}:{cpp_out_dir}")
+ protoc_cmd.append('--proto_path=' + path)
+
+ protoc_cmd.append(
+ f'--cpp_out=dllexport_decl=ROSIDL_ADAPTER_PROTO_PUBLIC__{package_name}:{cpp_out_dir}')
protoc_cmd = protoc_cmd + proto_files
- subprocess.check_call(protoc_cmd)
\ No newline at end of file
+ subprocess.check_call(protoc_cmd)
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support.hpp
index 33ef29b..57dbf1a 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support.hpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -29,11 +29,9 @@ typedef struct message_type_support_t
const char * message_namespace;
const char * message_name;
- bool (* serialize)(const void * ros_message, std::string& serialized_message);
- bool (* deserialize)(void * ros_message, const void *serialized_data, size_t size);
- std::string (*get_descriptor)();
-
+ bool (* serialize)(const void * ros_message, std::string & serialized_message);
+ bool (* deserialize)(void * ros_message, const void * serialized_data, size_t size);
+ std::string (* get_descriptor)();
} message_type_support_t;
-}
-
+} // namespace rosidl_typesupport_protobuf
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support_decl.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support_decl.hpp
index 93d3179..509fbe1 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support_decl.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/message_type_support_decl.hpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -21,7 +21,7 @@
#include
-//rosidl_message_type_support_t
+// rosidl_message_type_support_t
#include "rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp"
namespace rosidl_typesupport_protobuf
@@ -32,4 +32,4 @@ template
ROSIDL_TYPESUPPORT_PROTOBUF_PUBLIC
const rosidl_message_type_support_t * get_message_type_support_handle();
-} // namespace rosidl_typesupport_protobuf_cpp
+} // namespace rosidl_typesupport_protobuf
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/proto_descriptor_helper.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/proto_descriptor_helper.hpp
index 0d71133..95a71a2 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/proto_descriptor_helper.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/proto_descriptor_helper.hpp
@@ -1,6 +1,23 @@
+/* ================================ Apache 2.0 =================================
+ *
+ * Copyright (C) 2021 Continental
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ================================ Apache 2.0 =================================
+ */
#pragma once
-#include
#include
#include
#include
@@ -8,7 +25,7 @@
// protobuf includes
#ifdef _MSC_VER
#pragma warning(push)
-#pragma warning(disable: 4100 4127 4146 4800) // disable proto warnings
+#pragma warning(disable: 4100 4127 4146 4800) // disable proto warnings
#endif
#include
#ifdef _MSC_VER
@@ -16,86 +33,76 @@
#endif
-inline bool HasFile(const google::protobuf::FileDescriptorSet& fset_, const std::string& fname_)
+inline bool HasFile(const google::protobuf::FileDescriptorSet & fset_, const std::string & fname_)
{
- for (auto findex = 0; findex < fset_.file_size(); ++findex)
- {
- if (fset_.file(findex).name() == fname_)
- {
- return(true);
+ for (auto findex = 0; findex < fset_.file_size(); ++findex) {
+ if (fset_.file(findex).name() == fname_) {
+ return true;
}
}
- return(false);
+ return false;
}
-inline bool GetFileDescriptor(const google::protobuf::Descriptor* desc_, google::protobuf::FileDescriptorSet& fset_)
+inline bool GetFileDescriptor(
+ const google::protobuf::Descriptor * desc_,
+ google::protobuf::FileDescriptorSet & fset_)
{
-
- if (desc_ == nullptr) return(false);
- const google::protobuf::FileDescriptor* fdesc = desc_->file();
-
- for (auto dep = 0; dep < fdesc->dependency_count(); ++dep)
- {
+ if (desc_ == nullptr) {return false;}
+ const google::protobuf::FileDescriptor * fdesc = desc_->file();
+
+ for (auto dep = 0; dep < fdesc->dependency_count(); ++dep) {
// iterate containing messages
- const google::protobuf::FileDescriptor* sfdesc = fdesc->dependency(dep);
-
- for (auto mtype = 0; mtype < sfdesc->message_type_count(); ++mtype)
- {
- const google::protobuf::Descriptor* desc = sfdesc->message_type(mtype);
+ const google::protobuf::FileDescriptor * sfdesc = fdesc->dependency(dep);
+
+ for (auto mtype = 0; mtype < sfdesc->message_type_count(); ++mtype) {
+ const google::protobuf::Descriptor * desc = sfdesc->message_type(mtype);
GetFileDescriptor(desc, fset_);
}
// containing enums ?
- if (sfdesc->enum_type_count() > 0)
- {
- const google::protobuf::EnumDescriptor* edesc = sfdesc->enum_type(0);
- const google::protobuf::FileDescriptor* efdesc = edesc->file();
+ if (sfdesc->enum_type_count() > 0) {
+ const google::protobuf::EnumDescriptor * edesc = sfdesc->enum_type(0);
+ const google::protobuf::FileDescriptor * efdesc = edesc->file();
- if (!HasFile(fset_, efdesc->name()))
- {
- google::protobuf::FileDescriptorProto* epdesc = fset_.add_file();
+ if (!HasFile(fset_, efdesc->name())) {
+ google::protobuf::FileDescriptorProto * epdesc = fset_.add_file();
efdesc->CopyTo(epdesc);
}
}
-
// containing services ?
- if (sfdesc->service_count() > 0)
- {
- const google::protobuf::ServiceDescriptor* svdesc = sfdesc->service(0);
- const google::protobuf::FileDescriptor* svfdesc = svdesc->file();
+ if (sfdesc->service_count() > 0) {
+ const google::protobuf::ServiceDescriptor * svdesc = sfdesc->service(0);
+ const google::protobuf::FileDescriptor * svfdesc = svdesc->file();
- if (!HasFile(fset_, svfdesc->name()))
- {
- google::protobuf::FileDescriptorProto* svpdesc = fset_.add_file();
+ if (!HasFile(fset_, svfdesc->name())) {
+ google::protobuf::FileDescriptorProto * svpdesc = fset_.add_file();
svfdesc->CopyTo(svpdesc);
}
}
}
- if (HasFile(fset_, fdesc->name())) return(true);
+ if (HasFile(fset_, fdesc->name())) {return true;}
- google::protobuf::FileDescriptorProto* pdesc = fset_.add_file();
+ google::protobuf::FileDescriptorProto * pdesc = fset_.add_file();
fdesc->CopyTo(pdesc);
- for (auto field = 0; field < desc_->field_count(); ++field)
- {
- const google::protobuf::FieldDescriptor* fddesc = desc_->field(field);
- const google::protobuf::Descriptor* desc = fddesc->message_type();
+ for (auto field = 0; field < desc_->field_count(); ++field) {
+ const google::protobuf::FieldDescriptor * fddesc = desc_->field(field);
+ const google::protobuf::Descriptor * desc = fddesc->message_type();
GetFileDescriptor(desc, fset_);
}
- return(true);
+ return true;
}
template
inline std::string GetProtoMessageDescription()
{
- const google::protobuf::Descriptor* desc = T::descriptor();
+ const google::protobuf::Descriptor * desc = T::descriptor();
google::protobuf::FileDescriptorSet pset;
- if (GetFileDescriptor(desc, pset))
- {
+ if (GetFileDescriptor(desc, pset)) {
std::string desc_s = pset.SerializeAsString();
- return(desc_s);
+ return desc_s;
}
- return("");
-}
\ No newline at end of file
+ return "";
+}
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp
index 70ffd74..7cef40d 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-*
+*
* http://www.apache.org/licenses/LICENSE-2.0
-*
+*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,10 +17,10 @@
* ========================= RMW eCAL LICENSE =================================
*/
-//From Foxy distro rosidl_generator_c has been renamed to rosidl_generator_c,
-//purpose of this header file is to alias old C type names to new ones, that way the
-//rest of the code doesn't have to care about old package name regardless of distro.
-//any rosidl_generator_c to rosidl_runtime_c adaptions should be added here
+// From Foxy distro rosidl_generator_c has been renamed to rosidl_generator_c,
+// purpose of this header file is to alias old C type names to new ones, that way the
+// rest of the code doesn't have to care about old package name regardless of distro.
+// any rosidl_generator_c to rosidl_runtime_c adaptions should be added here
#pragma once
@@ -32,4 +32,3 @@
#include
#include
#include
-
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support.hpp
index da558fc..256e9b2 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support.hpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -35,4 +35,4 @@ typedef struct service_type_support_t
const rosidl_message_type_support_t * response;
} service_type_support_t;
-}
\ No newline at end of file
+} // namespace rosidl_typesupport_protobuf
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support_decl.hpp b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support_decl.hpp
index 854b99f..8c6ec15 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support_decl.hpp
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/service_type_support_decl.hpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -21,7 +21,7 @@
#include
-//rosidl_service_type_support_t
+// rosidl_service_type_support_t
#include "rosidl_typesupport_protobuf/rosidl_generator_c_pkg_adapter.hpp"
namespace rosidl_typesupport_protobuf
@@ -36,4 +36,4 @@ template
ROSIDL_TYPESUPPORT_PROTOBUF_PUBLIC
const rosidl_service_type_support_t * get_service_type_support_handle();
-} // namespace rosidl_typesupport_protobuf_cpp
+} // namespace rosidl_typesupport_protobuf
diff --git a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/visibility_control.h b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/visibility_control.h
index ce6940d..73d2a5b 100644
--- a/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/visibility_control.h
+++ b/rosidl_typesupport_protobuf/include/rosidl_typesupport_protobuf/visibility_control.h
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
#pragma once
@@ -54,4 +54,4 @@ extern "C"
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/rosidl_typesupport_protobuf/rosidl_typesupport_protobuf/__init__.py b/rosidl_typesupport_protobuf/rosidl_typesupport_protobuf/__init__.py
index c15e430..e37b701 100644
--- a/rosidl_typesupport_protobuf/rosidl_typesupport_protobuf/__init__.py
+++ b/rosidl_typesupport_protobuf/rosidl_typesupport_protobuf/__init__.py
@@ -16,107 +16,126 @@
#
# ================================= Apache 2.0 =================================
-import os
-
from rosidl_cmake import convert_camel_case_to_lower_case_underscore
-from rosidl_parser import definition
# A postfix for the protobuf package name / the c++ namespace
-PROTO_PACKAGE_POSTFIX = "pb"
+PROTO_PACKAGE_POSTFIX = 'pb'
+
+_TYPE_SUPPORT_NAME = ''
+_NAMESPACE_DELIMETER = ''
-_TYPE_SUPPORT_NAME = ""
-_NAMESPACE_DELIMETER = ""
def set_type_support_name(val):
- global _TYPE_SUPPORT_NAME
- _TYPE_SUPPORT_NAME = val
+ global _TYPE_SUPPORT_NAME
+ _TYPE_SUPPORT_NAME = val
+
def set_namespace_delimeter(val):
- global _NAMESPACE_DELIMETER
- _NAMESPACE_DELIMETER = val
+ global _NAMESPACE_DELIMETER
+ _NAMESPACE_DELIMETER = val
+
def ros_message_header(package_name, interface_path):
- include_parts = [package_name] + list(interface_path.parents[0].parts)
- include_parts += ["detail"]
- include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
- include_base = '/'.join(include_parts)
+ include_parts = [package_name] + list(interface_path.parents[0].parts)
+ include_parts += ['detail']
+ include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
+ include_base = '/'.join(include_parts)
+
+ return f'{include_base}__struct.hpp'
- return f"{include_base}__struct.hpp"
def ros_message_header_c(package_name, interface_path):
- include_parts = [package_name] + list(interface_path.parents[0].parts)
- include_parts += ["detail"]
- include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
- include_base = '/'.join(include_parts)
+ include_parts = [package_name] + list(interface_path.parents[0].parts)
+ include_parts += ['detail']
+ include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
+ include_base = '/'.join(include_parts)
+
+ return f'{include_base}__struct.h'
- return f"{include_base}__struct.h"
def ros_message_functions_header_c(package_name, interface_path):
- include_parts = [package_name] + list(interface_path.parents[0].parts)
- include_parts += ["detail"]
- include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
- include_base = '/'.join(include_parts)
+ include_parts = [package_name] + list(interface_path.parents[0].parts)
+ include_parts += ['detail']
+ include_parts += [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
+ include_base = '/'.join(include_parts)
+
+ return f'{include_base}__functions.h'
- return f"{include_base}__functions.h"
def ros_message_functions_header_c_from_namespace(namespace, name):
- include_parts = list(namespace)
- include_parts += ["detail"]
- include_parts += [convert_camel_case_to_lower_case_underscore(name)]
- include_base = '/'.join(include_parts)
+ include_parts = list(namespace)
+ include_parts += ['detail']
+ include_parts += [convert_camel_case_to_lower_case_underscore(name)]
+ include_base = '/'.join(include_parts)
+
+ return f'{include_base}__functions.h'
- return f"{include_base}__functions.h"
def protobuf_message_header(package_name, interface_path):
- include_parts = [package_name] + list(interface_path.parents[0].parts)
- include_base = '/'.join(include_parts)
- include_prefix = interface_path.stem
+ include_parts = [package_name] + list(interface_path.parents[0].parts)
+ include_prefix = interface_path.stem
+
+ return '/'.join(include_parts + [include_prefix + '.pb.h'])
- return '/'.join(include_parts + [include_prefix + ".pb.h"])
def typesupport_header(package_name, interface_path):
- include_parts = [package_name] + list(interface_path.parents[0].parts) + [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
- include_base = '/'.join(include_parts)
-
- return f"{include_base}__{_TYPE_SUPPORT_NAME}.hpp"
+ include_parts = [package_name] + list(interface_path.parents[0].parts) + \
+ [convert_camel_case_to_lower_case_underscore(interface_path.stem)]
+ include_base = '/'.join(include_parts)
+
+ return f'{include_base}__{_TYPE_SUPPORT_NAME}.hpp'
+
def visibility_control_header(package_name):
- return f"{package_name}/{_TYPE_SUPPORT_NAME}__visibility_control.h"
+ return f'{package_name}/{_TYPE_SUPPORT_NAME}__visibility_control.h'
+
def ros_type_namespace(package_name, interface_path):
- return _NAMESPACE_DELIMETER.join([package_name] + list(interface_path.parents[0].parts))
+ return _NAMESPACE_DELIMETER.join([package_name] + list(interface_path.parents[0].parts))
+
def ros_type_name(message):
- return message.structure.namespaced_type.name
+ return message.structure.namespaced_type.name
+
def ros_type(package_name, interface_path, message):
- ros_type_ns = ros_type_namespace(package_name, interface_path)
- ros_type_nm = ros_type_name(message)
- return "::" + _NAMESPACE_DELIMETER.join([ros_type_ns, ros_type_nm])
+ ros_type_ns = ros_type_namespace(package_name, interface_path)
+ ros_type_nm = ros_type_name(message)
+ return '::' + _NAMESPACE_DELIMETER.join([ros_type_ns, ros_type_nm])
+
def ros_type_from_namespaced_type(namespaced_type):
- return "::" + _NAMESPACE_DELIMETER.join(namespaced_type.namespaces + [namespaced_type.name])
+ return '::' + _NAMESPACE_DELIMETER.join(namespaced_type.namespaces + [namespaced_type.name])
+
def ros_type_from_namespaced_type_c(namespaced_type):
- return "::" + _NAMESPACE_DELIMETER.join(namespaced_type.namespaces + [namespaced_type.name])
+ return '::' + _NAMESPACE_DELIMETER.join(namespaced_type.namespaces + [namespaced_type.name])
+
def ros_service_namespace(package_name, interface_path):
- return _NAMESPACE_DELIMETER.join([package_name] + list(interface_path.parents[0].parts))
+ return _NAMESPACE_DELIMETER.join([package_name] + list(interface_path.parents[0].parts))
+
def ros_service_name(service):
- return service.namespaced_type.name
+ return service.namespaced_type.name
+
def ros_service_type(package_name, interface_path, service):
- ros_type_ns = ros_service_namespace(package_name, interface_path)
- ros_type_nm = ros_service_name(service)
- return "::" + _NAMESPACE_DELIMETER.join([ros_type_ns, ros_type_nm])
+ ros_type_ns = ros_service_namespace(package_name, interface_path)
+ ros_type_nm = ros_service_name(service)
+ return '::' + _NAMESPACE_DELIMETER.join([ros_type_ns, ros_type_nm])
+
def protobuf_type(package_name, interface_path, message):
- namespace = "::".join([package_name] + list(interface_path.parents[0].parts))
- return "::" + "::".join([namespace, PROTO_PACKAGE_POSTFIX, ros_type_name(message)])
+ namespace = '::'.join([package_name] + list(interface_path.parents[0].parts))
+ return '::' + '::'.join([namespace, PROTO_PACKAGE_POSTFIX, ros_type_name(message)])
+
def protobuf_type_from_namespaced_type(namespaced_type):
- return "::" + "::".join(namespaced_type.namespaces + [PROTO_PACKAGE_POSTFIX, namespaced_type.name])
+ return '::' + '::'.join(namespaced_type.namespaces +
+ [PROTO_PACKAGE_POSTFIX, namespaced_type.name])
+
def protobuf_type_from_namespaced_type_c(namespaced_type):
- return "::" + "::".join(namespaced_type.namespaces + [PROTO_PACKAGE_POSTFIX, namespaced_type.name])
+ return '::' + '::'.join(namespaced_type.namespaces +
+ [PROTO_PACKAGE_POSTFIX, namespaced_type.name])
diff --git a/rosidl_typesupport_protobuf_c/package.xml b/rosidl_typesupport_protobuf_c/package.xml
index 40aa97c..99be2f2 100644
--- a/rosidl_typesupport_protobuf_c/package.xml
+++ b/rosidl_typesupport_protobuf_c/package.xml
@@ -27,9 +27,6 @@
rosidl_parser
rosidl_typesupport_interface
- ament_lint_auto
- ament_lint_common
-
rosidl_typesupport_c_packages
diff --git a/rosidl_typesupport_protobuf_cpp/CMakeLists.txt b/rosidl_typesupport_protobuf_cpp/CMakeLists.txt
index a74a0f2..cc6ebcc 100644
--- a/rosidl_typesupport_protobuf_cpp/CMakeLists.txt
+++ b/rosidl_typesupport_protobuf_cpp/CMakeLists.txt
@@ -35,9 +35,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
-if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- add_compile_options(/W4)
- add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
+if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+ add_compile_options(/W4)
+ add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
find_package(ament_cmake REQUIRED)
diff --git a/rosidl_typesupport_protobuf_cpp/cmake/rosidl_typesupport_protobuf_cpp_generate_interfaces.cmake b/rosidl_typesupport_protobuf_cpp/cmake/rosidl_typesupport_protobuf_cpp_generate_interfaces.cmake
index 62c4068..3b71698 100644
--- a/rosidl_typesupport_protobuf_cpp/cmake/rosidl_typesupport_protobuf_cpp_generate_interfaces.cmake
+++ b/rosidl_typesupport_protobuf_cpp/cmake/rosidl_typesupport_protobuf_cpp_generate_interfaces.cmake
@@ -106,7 +106,7 @@ configure_file(
set(_target_suffix "__rosidl_typesupport_protobuf_cpp")
add_library(${rosidl_generate_interfaces_TARGET}${_target_suffix} SHARED
- ${_generated_files}
+ ${_generated_files}
${rosidl_adapter_proto_GENERATED_CPP}
)
@@ -125,7 +125,7 @@ set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix}
if(WIN32)
target_compile_definitions(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PRIVATE "ROSIDL_TYPESUPPORT_PROTOBUF_BUILDING_DLL" "ROSIDL_TYPESUPPORT_PROTOBUF_CPP_BUILDING_DLL__${PROJECT_NAME}")
- set (Protobuf_USE_STATIC_LIBS TRUE)
+ set(Protobuf_USE_STATIC_LIBS TRUE)
endif()
# Set compiler flags
diff --git a/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/identifier.hpp b/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/identifier.hpp
index 083c23c..1e487b3 100644
--- a/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/identifier.hpp
+++ b/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/identifier.hpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -25,6 +25,6 @@ namespace rosidl_typesupport_protobuf_cpp
{
ROSIDL_TYPESUPPORT_PROTOBUF_IMPORT
-extern const char *identifier;
+extern const char * identifier;
} // namespace rosidl_typesupport_protobuf_cpp
diff --git a/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/wstring_conversion.hpp b/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/wstring_conversion.hpp
index e51b756..bb10e31 100644
--- a/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/wstring_conversion.hpp
+++ b/rosidl_typesupport_protobuf_cpp/include/rosidl_typesupport_protobuf_cpp/wstring_conversion.hpp
@@ -1,35 +1,36 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
#pragma once
+#include
+
#include
-#include
namespace rosidl_typesupport_protobuf_cpp
{
ROSIDL_TYPESUPPORT_PROTOBUF_PUBLIC
-void write_to_string(const std::u16string &u16str, std::string &str);
+void write_to_string(const std::u16string & u16str, std::string & str);
ROSIDL_TYPESUPPORT_PROTOBUF_PUBLIC
-void write_to_u16string(const std::string &str, std::u16string &u16str);
+void write_to_u16string(const std::string & str, std::u16string & u16str);
-}
\ No newline at end of file
+}
diff --git a/rosidl_typesupport_protobuf_cpp/rosidl_typesupport_protobuf_cpp/__init__.py b/rosidl_typesupport_protobuf_cpp/rosidl_typesupport_protobuf_cpp/__init__.py
index 644abe8..16585cb 100644
--- a/rosidl_typesupport_protobuf_cpp/rosidl_typesupport_protobuf_cpp/__init__.py
+++ b/rosidl_typesupport_protobuf_cpp/rosidl_typesupport_protobuf_cpp/__init__.py
@@ -16,9 +16,8 @@
#
# ================================= Apache 2.0 =================================
-import rosidl_typesupport_protobuf
+from rosidl_cmake import generate_files
-from rosidl_cmake import generate_files, convert_camel_case_to_lower_case_underscore
def generate_cpp(generator_arguments_file):
mapping = {
@@ -26,4 +25,4 @@ def generate_cpp(generator_arguments_file):
"idl__type_support.cpp.em": "detail/%s__type_support.cpp",
}
generate_files(generator_arguments_file, mapping)
- return 0
\ No newline at end of file
+ return 0
diff --git a/rosidl_typesupport_protobuf_cpp/src/identifier.cpp b/rosidl_typesupport_protobuf_cpp/src/identifier.cpp
index 29754be..abedb50 100644
--- a/rosidl_typesupport_protobuf_cpp/src/identifier.cpp
+++ b/rosidl_typesupport_protobuf_cpp/src/identifier.cpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -23,6 +23,6 @@ namespace rosidl_typesupport_protobuf_cpp
{
ROSIDL_TYPESUPPORT_PROTOBUF_EXPORT
-const char *identifier = "rosidl_typesupport_protobuf_cpp";
+const char * identifier = "rosidl_typesupport_protobuf_cpp";
} // namespace rosidl_typesupport_protobuf_cpp
diff --git a/rosidl_typesupport_protobuf_cpp/src/wstring_conversion.cpp b/rosidl_typesupport_protobuf_cpp/src/wstring_conversion.cpp
index 0dc9eb6..592709f 100644
--- a/rosidl_typesupport_protobuf_cpp/src/wstring_conversion.cpp
+++ b/rosidl_typesupport_protobuf_cpp/src/wstring_conversion.cpp
@@ -1,19 +1,19 @@
/* ================================ Apache 2.0 =================================
*
* Copyright (C) 2021 Continental
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ================================ Apache 2.0 =================================
*/
@@ -24,19 +24,19 @@
namespace rosidl_typesupport_protobuf_cpp
{
-void write_to_string(const std::u16string &u16str, std::string &str)
+void write_to_string(const std::u16string & u16str, std::string & str)
{
- auto data_size = u16str.size() * sizeof(std::u16string::value_type);
- str.resize(data_size);
- auto str_start = &str[0];
- std::memcpy(str_start, u16str.data(), data_size);
+ auto data_size = u16str.size() * sizeof(std::u16string::value_type);
+ str.resize(data_size);
+ auto str_start = &str[0];
+ std::memcpy(str_start, u16str.data(), data_size);
}
-void write_to_u16string(const std::string &str, std::u16string &u16str)
+void write_to_u16string(const std::string & str, std::u16string & u16str)
{
- u16str.resize(str.size() / sizeof(std::u16string::value_type));
- auto wstr_start = &u16str[0];
- std::memcpy(wstr_start, str.data(), str.size());
+ u16str.resize(str.size() / sizeof(std::u16string::value_type));
+ auto wstr_start = &u16str[0];
+ std::memcpy(wstr_start, str.data(), str.size());
}
-}
\ No newline at end of file
+} // namespace rosidl_typesupport_protobuf_cpp