|
| 1 | +// generated from rosidl_generator_cpp/resource/idl__type_support.hpp.em |
| 2 | +// with input from @(package_name):@(interface_path) |
| 3 | +// generated code does not contain a copyright notice |
| 4 | +@ |
| 5 | +@####################################################################### |
| 6 | +@# EmPy template for generating <idl>__struct.h files |
| 7 | +@# |
| 8 | +@# Context: |
| 9 | +@# - package_name (string) |
| 10 | +@# - interface_path (Path relative to the directory named after the package) |
| 11 | +@# - content (IdlContent, list of elements, e.g. Messages or Services) |
| 12 | +@####################################################################### |
| 13 | +@{ |
| 14 | +from rosidl_cmake import convert_camel_case_to_lower_case_underscore |
| 15 | +include_parts = [package_name] + list(interface_path.parents[0].parts) + [ |
| 16 | + 'detail', convert_camel_case_to_lower_case_underscore(interface_path.stem)] |
| 17 | +header_guard_variable = '__'.join([x.upper() for x in include_parts]) + \ |
| 18 | + '__TYPE_SUPPORT_HPP_' |
| 19 | + |
| 20 | +include_directives = set() |
| 21 | +}@ |
| 22 | + |
| 23 | +#ifndef @(header_guard_variable) |
| 24 | +#define @(header_guard_variable) |
| 25 | + |
| 26 | +#include "rosidl_typesupport_interface/macros.h" |
| 27 | + |
| 28 | +#include "@(package_name)/msg/rosidl_generator_cpp__visibility_control.hpp" |
| 29 | + |
| 30 | +@####################################################################### |
| 31 | +@# Handle message |
| 32 | +@####################################################################### |
| 33 | +@{ |
| 34 | +from rosidl_parser.definition import Message |
| 35 | +}@ |
| 36 | +@[for message in content.get_elements_of_type(Message)]@ |
| 37 | +@{ |
| 38 | +TEMPLATE( |
| 39 | + 'msg__type_support.hpp.em', |
| 40 | + package_name=package_name, message=message, |
| 41 | + include_directives=include_directives) |
| 42 | +}@ |
| 43 | + |
| 44 | +@[end for]@ |
| 45 | +@ |
| 46 | +@####################################################################### |
| 47 | +@# Handle service |
| 48 | +@####################################################################### |
| 49 | +@{ |
| 50 | +from rosidl_parser.definition import Service |
| 51 | +}@ |
| 52 | +@[for service in content.get_elements_of_type(Service)]@ |
| 53 | +@{ |
| 54 | +TEMPLATE( |
| 55 | + 'srv__type_support.hpp.em', |
| 56 | + package_name=package_name, service=service, |
| 57 | + include_directives=include_directives) |
| 58 | +}@ |
| 59 | + |
| 60 | +@[end for]@ |
| 61 | +@ |
| 62 | +@####################################################################### |
| 63 | +@# Handle action |
| 64 | +@####################################################################### |
| 65 | +@{ |
| 66 | +from rosidl_parser.definition import Action |
| 67 | +}@ |
| 68 | +@[for action in content.get_elements_of_type(Action)]@ |
| 69 | +@{ |
| 70 | +TEMPLATE( |
| 71 | + 'action__type_support.hpp.em', |
| 72 | + package_name=package_name, action=action, |
| 73 | + include_directives=include_directives) |
| 74 | +}@ |
| 75 | + |
| 76 | +@[end for]@ |
| 77 | +#endif // @(header_guard_variable) |
0 commit comments