Function cras::getHeader

Function Documentation

::cras::optional<::std_msgs::Header> cras::getHeader(const ::topic_tools::ShapeShifter &msg)

Get the header field of the given message, if it has any.

Note

This function can have some “false positives”, as it doesn’t actually know whether the message has a header or not. There is a high chance that if the message does not have a header, the reading of Header data will fail, but there are corner cases when the message data will be interpretable as a Header. It is advised to check whether the message type has a header via introspection, hasHeader() or some other kind of information.

Parameters:

msg[in] The shape shifter object.

Returns:

The header of the represented message. If there is no header, nullopt is returned.