Hi, the serialization library is almost what im after. My only problem is that in the archive output additional data is added to the start of the archive (for example "22 serialization::archive" for text files). Is there any way of disabling this? In my case, I require a pure binary archive. Ideally i would like to write one if one doesnt exist but i'm not sure if i have time, depending on how hard it would be. How hard would it be do make my own archive type, where by i could set the endian field to convert bigendian to littleendian depending on what the user defines the 'archive endianess' to be on archive construction? I have done this with my own serialization library, however i dont want to extend that because it only handles c++ primitives and dealing with pointers things start getting horrible very very quickly! Thanks in advance. Chris _________________________________________________________________ MSN Messenger 7.5 is now out. Download it for FREE here. http://messenger.msn.co.uk
At 5:54 PM +0000 12/2/05, Chris . wrote:
Hi, the serialization library is almost what im after. My only problem is that in the archive output additional data is added to the start of the archive (for example "22 serialization::archive" for text files). Is there any way of disabling this? In my case, I require a pure binary archive.
Use the boost::archive::no_header flag. You might also want to consider the boost::archive::no_codecvt flag. These flags are passed as an argument to the archive constructor.
Chris . wrote:
Hi, the serialization library is almost what im after. My only problem is that in the archive output additional data is added to the start of the archive (for example "22 serialization::archive" for text files). Is there any way of disabling this? In my case, I require a pure binary archive. Ideally i would like to write one if one doesnt exist but i'm not sure if i have time, depending on how hard it would be.
Use the "no_header" flag when you open the achive.
How hard would it be do make my own archive type, where by i could set the endian field to convert bigendian to littleendian depending on what the user defines the 'archive endianess' to be on archive construction? I have done this with my own serialization library, however i dont want to extend that because it only handles c++ primitives and dealing with pointers things start getting horrible very very quickly!
Take a look at the "portable_binary_archive" example. This shows how to make your own archive by deriving from an existing one. Note that the portable_binary_archive handles endian issues but does not include portable floating point. If you need this, you'll have to finish the example. Good Luck Robert Ramey
Take a look at the "portable_binary_archive" example. This shows how to make your own archive by deriving from an existing one. Note that the portable_binary_archive handles endian issues but does not include portable floating point. If you need this, you'll have to finish the example.
Hi Robert, i have been going through your example code, thanks for the help. I do have a problem in that i see "serialization bookmarking" data is inserted into the stream, this is default archive behaviour so i am trying to overide this part of the archives functionality and replace it with a dummy function which does nothing... in other words i am after a raw binary stream without a version numbers and without this bookmark data. I have done stack traces at breakpoints where this bookmarking data seems to be written, but there are a lot of calls and i will be honest i am getting lost! Any further pointers much appreciated. Thanks Chris
There is no book keeping data that is not required to support some serialization functionality. That is, if you eliminate the bookkeeping information, the serialization system won't work in all its glory. However, in many cases the bookkeeping information can be diminished or perhaps eliminated by setting serialization traits to a lower level to so that all the serialization functionality is not used. Reasons for different settings (e.g. implementation level, tracking, etc) is described in the documentation. I all you want are "write only" archives, then of course you can suppress all the book keeping data you want. As an example, you might want to look at the implemenation for xml_?archive which includes special handling of all the book keeping data to fit it into xml format. This is an exhaustive list. So just re-implement these for your binary archive to do nothing. You won't be able to read the archives back of course. Good Luck Robert Ramey Chris Morley wrote:
Take a look at the "portable_binary_archive" example. This shows how to make your own archive by deriving from an existing one. Note that the portable_binary_archive handles endian issues but does not include portable floating point. If you need this, you'll have to finish the example.
Hi Robert, i have been going through your example code, thanks for the help. I do have a problem in that i see "serialization bookmarking" data is inserted into the stream, this is default archive behaviour so i am trying to overide this part of the archives functionality and replace it with a dummy function which does nothing... in other words i am after a raw binary stream without a version numbers and without this bookmark data. I have done stack traces at breakpoints where this bookmarking data seems to be written, but there are a lot of calls and i will be honest i am getting lost! Any further pointers much appreciated. Thanks
Chris
participants (4)
-
Chris .
-
Chris Morley
-
Kim Barrett
-
Robert Ramey