proto2ros.output.cpp module

This module provides APIs to write C++ conversion code.

proto2ros.output.cpp.dump_conversions_cpp_sources(package_name: str, message_specifications: List[rosidl_adapter.parser.MessageSpecification], known_message_specifications: List[rosidl_adapter.parser.MessageSpecification], config: Configuration) Tuple[str, str]

Dumps the C++ sources for Protobuf <-> ROS conversion APIs.

Args:

package_name: name of the package that will host the APIs. message_specifications: annotated ROS message specifications, as derived from equivalence relations (see proto2ros.equivalences). known_message_specifications: all annotated ROS message specifications known, including those from dependencies. A superset of message_specifications. config: a suitable configuration for the procedure.

Returns:

the conversion C++ header and source files’ content, in that order.

proto2ros.output.cpp.itemize_cpp_identifier(identifier: str, prefix: str | None = None) str

Derives a loop variable identifier for its iterable variable identifier.

proto2ros.output.cpp.to_hungarian_notation(name: str) str

Transforms the given valid C++ name to hungarian notation.

E.g. some_name_of_mine translates to kSomeNameOfMine.

proto2ros.output.cpp.to_pb2_cpp_header(source_path: PathLike) str

Returns the C++ header for a given Protobuf source file.

proto2ros.output.cpp.to_pb2_cpp_type(type_name: str) str

Returns the C++ class name for a given Protobuf message type.

proto2ros.output.cpp.to_ros_cpp_header(spec: rosidl_adapter.parser.MessageSpecification) str

Returns the C++ header for a given ROS message specification.

proto2ros.output.cpp.to_ros_cpp_namespace(package_name: str) str

Returns the C++ namespace for a given ROS message package.

proto2ros.output.cpp.to_ros_cpp_type(type_name: str | rosidl_adapter.parser.BaseType) str

Returns the C++ class name for a given ROS message type.