How to use boost serialization with CORBA (ACE/TAO) -



How to use boost serialization with CORBA (ACE/TAO) -

i'm trying serialize info struct, send on network , deserialize on other side. works fine if both sides consistently compiled x64 or x86 won't work between two, if serialize single boolean.

serialization code:

myclass myc; std::stringstream ss; boost::archive::text_oarchive oa(ss); oa << myc; // stringstream's length ss.seekg(0, ios::end); int len = ss.tellg(); ss.seekg(0, ios::beg); // allocate corba type , re-create stringstream buffer on const std::string re-create = ss.str(); // re-create since str() generates temporary object const char* buffer = copy.c_str(); // bytesequence sequence of octets 1 time again defined raw, platform-independent byte type corba standard idl::bytesequence_var byteseq(new idl::bytesequence()); byteseq->length(len); memcpy(byteseq->get_buffer(), buffer, len); homecoming byteseq._retn();

deserialization code:

idl::bytesequence_var byteseq; byteseq = _remoteobject->getmyclass(); // re-create corba input sequence local char buffer int seqlen = byteseq->length(); std::unique_ptr<char[]> buffer(new char[seqlen]); memcpy(buffer.get(), byteseq->get_buffer(), seqlen); // set buffer stringstream std::stringstream ss; std::stringbuf* ssbuf = ss.rdbuf(); ssbuf->sputn(buffer.get(), seqlen); // deserialize stringstream // throws exception 'unsupported version' between x86 , x64 boost::archive::text_iarchive ia(ss); myclass result; ia >> result;

as far can tell without testing caused different boost versions on various architectures, see boost serialization: archive "unsupported version" exception

serialization boost corba ace-tao

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -