[ros-users] Ros Communications

Troy Straszheim straszheim at willowgarage.com
Tue Dec 7 00:23:24 UTC 2010


On Mon, Dec 6, 2010 at 4:05 PM, Piotr Trojanek <piotr.trojanek at gmail.com> wrote:
> Yes, I have tested the archive with std::vector and it simply works.
>
> I guess it works also for any collection, which is supported by
> Boost::serialization framework.
> The magic is in the <boost/serialization/vector.hpp> header, not in the
> archive itself.
>
> For any primitive type always the same xdr_* function is called, so (by the
> design of XDR)
> it does not matter if the caller is 32 or 64 bit (nor if little/big endian).
>

Interesting.  collection_size_type is std::size_t:

  BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type)

and in some implementations std::size_t is 'unsigned long'.  If you
then use this implementation on two platforms where
'unsigned long' have different sizes, you will get incompatible
archives.   In my experience with portable binary archives (we are
going way back to boost 1.32), it was necessary to choose a size (e.g.
handle collection_size_type explicitly and cast to uint64_t, for
example).

Cool archive, in any event.  boost::serialization is incredibly useful stuff.

-t



More information about the ros-users mailing list