15 #ifndef RCLCPP__TYPE_ADAPTER_HPP_
16 #define RCLCPP__TYPE_ADAPTER_HPP_
18 #include <type_traits>
97 template<
typename CustomType,
typename ROSMessageType =
void,
class Enable =
void>
100 using is_specialized = std::false_type;
101 using custom_type = CustomType;
104 using ros_message_type = CustomType;
112 template<
typename ... Ts>
117 struct TypeAdapter<T, void, std::enable_if_t<is_type_adapter<T>::value>>: T {};
122 template<
typename CustomType,
typename ROSMessageType>
127 type_adapter::is_specialized::value,
128 "No type adapter for this custom type/ros message type pair");
134 template<
typename CustomType>
137 template<
typename ROSMessageType>
138 using as = typename ::rclcpp::detail::assert_type_pair_is_specialized_type_adapter<
161 template<
typename CustomType>
164 using is_specialized = std::false_type;
176 struct TypeAdapter<T, void, std::enable_if_t<ImplicitTypeAdapter<T>::is_specialized::value>>
189 #define RCLCPP_USING_CUSTOM_TYPE_AS_ROS_MESSAGE_TYPE(CustomType, ROSMessageType) \
191 struct rclcpp::ImplicitTypeAdapter<CustomType> \
192 : public rclcpp::TypeAdapter<CustomType, ROSMessageType> \
195 is_specialized::value, \
196 "Cannot use custom type as ros type when there is no TypeAdapter for that pair"); \
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Implicit type adapter used as a short hand way to create something with just the custom type.
Template structure used to adapt custom, user-defined types to ROS types.
Template metafunction that can make the type being adapted explicit.
Helper template to determine if a type is a TypeAdapter, false specialization.