.. _program_listing_file__tmp_ws_src_grid_map_grid_map_ros_include_grid_map_ros_message_traits.hpp: Program Listing for File message_traits.hpp =========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/grid_map/grid_map_ros/include/grid_map_ros/message_traits.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef GRID_MAP_ROS__MESSAGE_TRAITS_HPP_ #define GRID_MAP_ROS__MESSAGE_TRAITS_HPP_ #include #include #include #include #include namespace ros { namespace message_traits { template struct HasHeader : public std::false_type {}; template struct HasHeader: std::true_type {}; template struct Header { static std_msgs::msg::Header * pointer(M & m) { (void)m; return nullptr; } static std_msgs::msg::Header const * pointer(const M & m) { (void)m; return nullptr; } }; template struct Header::value>::type> { static std_msgs::msg::Header * pointer(M & m) { return &m.header; } static std_msgs::msg::Header const * pointer(const M & m) { return &m.header; } }; template struct FrameId { static std::string * pointer(M & m) { (void)m; return nullptr; } static std::string const * pointer(const M & m) { (void)m; return nullptr; } }; template struct FrameId::value>::type> { static std::string * pointer(M & m) { return &m.header.frame_id; } static std::string const * pointer(const M & m) { return &m.header.frame_id; } static std::string value(const M & m) { return m.header.frame_id; } }; template struct TimeStamp { static std::unique_ptr pointer(const M & m) { (void)m; return nullptr; } static rclcpp::Time value(const M & m) { (void)m; return rclcpp::Time(); } }; template struct TimeStamp::value>::type> { static std::unique_ptr pointer(const M & m) { auto stamp = m.header.stamp; return std::make_unique(rclcpp::Time(stamp.sec, stamp.nanosec)); } static rclcpp::Time value(const M & m) { auto stamp = m.header.stamp; return rclcpp::Time(stamp.sec, stamp.nanosec); } }; } // namespace message_traits } // namespace ros #endif // GRID_MAP_ROS__MESSAGE_TRAITS_HPP_