Ask Your Question
1

How safe is it to directly modify message member vectors in c++?

asked 2012-10-24 06:50:01 -0500

SuperElectric gravatar image

updated 2014-01-28 17:14:03 -0500

ngrennan gravatar image

I have a custom message class A that contains vectors (of other message classes, but I think that's immaterial).

Is it safe to mess around with the vectors directly, by resizing them, inserting things into them, etc?

My concern is that A's header might contain some metadata about A's vector, which becomes out-of-date when I modify A's vector.

-- Matt

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2012-10-24 07:14:52 -0500

Lorenz gravatar image

There is nothing like a message header that contains hidden meta-information in ROS. Modifying message members is save and is even necessary to fill messages before publishing them.

But do not const-cast and modify messages you received in message callbacks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-10-24 06:50:01 -0500

Seen: 134 times

Last updated: Oct 24 '12