Hi
I am using boost serialization to synchronise objects between different
computers (network). The objects would be serializated as a string instead
of a file by using the class stringstream(instead of fstream). The string
would be transferred via TCP/IP layer.
Let simpify the situation as only two computers (Master and Slave) ,both of
two computers have N objects and I wanna synchronise their content. I create
a vector of pointer ( std::vector m_vpBase ) which points to the
dirty objects. Both of two computers have this vector. Let assume the
vectors are already pointing to the corresponding objects. For Tx side, it
would serialize the objects as a string. For Rx side, I want to update the
content of the objects that its vector is pointing to.
Tx side:
oa << BOOST_SERIALIZATION_NVP(m_vpBase);
Rx side:
oa >> BOOST_SERIALIZATION_NVP(m_vpBase );
However, the above code would construct new objects.
What i want is just update the content of the objects , not construct new
objects.
I know how to update the content for one object by using pointer ( base *
m_pBase).
Tx side:
oa << BOOST_SERIALIZATION_NVP(m_pBase);
Rx side:
oa >> BOOST_SERIALIZATION_NVP(*m_pBase);
But, I don't know how to do for a vector of pointer. If you know, please
give me some hints. Thank you very much.
Regards
Barr Ng
[I found Boost serialization is useful and easy to use. ]
_________________________________________________________________
No masks required! Use MSN Messenger to chat with friends and family.
http://go.msnserver.com/HK/25382.asp