Hi Patrick,
thanks for the hint. I changed the bool putValue and getValue method, it
reads/writes now a bool always as one byte on all platforms.
Andreas
I ran across a problem with using OpenSG's binary data handler between
different platforms with Mac OS X is involved. On Mac OS X, the bool type
is four bytes, and it is of course only one byte on most (all?) other
platforms. Unfortunately, OGS::BinaryDataHandler::putValue(bool) does not
account for this, so synchronization errors can occur when a bool is put
into the data stream. In my code, I could work around this easily by
passing OSG::UInt8 instead of bool, but this could trip up other
people--especially those who are not writing custom OpenSG-based clustering
protocols.
I don't necessarily have the best solution for working around this, but the
following would be the OpenSG equivalent of VR Juggler handles it:
inline
void BinaryDataHandler::putValue(const bool &value)
{
#ifdef __APPLE__
OSG::UInt8 temp = (OSG::UInt8) value;
put(&temp, sizeof(OSG::UInt8));
#else
put(&value, sizeof(bool));
#endif
}
-Patrick
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users