Function cras::setHeader
Defined in File shape_shifter.h
Function Documentation
-
bool cras::setHeader(::topic_tools::ShapeShifter &msg, ::std_msgs::Header &header)
Change the
headerfield of the given message, if it has any.Note
This function does not (de)serialize the whole message, it only serializes its header part.
Note
If the new header is shorter or same length as the old one, there is no memory allocation happening.
- Parameters:
msg – [inout] The message to change.
header – [in] The header to set.
- Returns:
Whether setting the new header has succeeded. It will fail if either the message does not seem to have a
headerfield, or if some serialization/deserialization error occurs. If the function returns false, the message has to be considered invalid and has to be discarded. The caller should usegetHeader()or other information sources to make sure the message type actually does have a header.