Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-07-30 12:22:33


Alejandro Martinez wrote:
>> What i need to do is this:
>>
>> Have a php file in a webserver, doing a POST with binary payload to a
>> fast-cgi written in c++, and the c++ should deserialize that payload
>> into a known struct.
>>
>> something like:
>>
>> struct whatever
>> {
>> int a;
>> int b;
>> float c;
>> std::vector<int> d;
>> }
>>
>> (mainly structs consisting of basic types and collections of basic
>> types)

Generally I would not recommend trying to read/process/creat archives
in language other that C++ with boost serialization. It is doable and
people have done it, but it breaks one of the most valuable features
of boost serialization - no brainer archive format maintainence.

>> I've been playing around with boost::serialization, but i can't seem
>> to comprehend the binary format it generates (So i could hardcode
>> the php to make a valid payload to be deserialised from the
>> fast-cgi).

The easiest way to understand the format of the file
is to write to an xml_archive. This will contain all
the same data in a more readible way.

>> And not so important: i've noticed boost::serialization to binary
>> archives always look like:
>>
>>  serialization::archive   ÃõH@   
>>

the "serialization::archive" is an identifier which
the de-serialization uses to gracefully handle the
situation where one hands it a file not created by
serialization. To suppress it, use "no_header" flag
when opening archives.
>> can't i get rid of the "serialization::archive" thing that is
>> obviusly not part of the struct i just serialized?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net