Re: [Boost-users] Boost serialization: is there a way to perform selective read
The problem with this solution is that it is time consuming, to open file for a key, i would like to use the boost serializeation to improve time preformance.
What is realy required is some mechanism, to identify an instance according to its key and only than read its data. Thus reading only the required instnace (accordig to its key) and not also the previous data at the file, someting like seek.
I hoped that "XML boost" can supply someting like that, but could not find how.
Thanks,
-Ariella
----- Original Message ----
From: gchen
Hey,
I would like to know whether there is a way to preform selective read using Boost serialization http://www.boost.org/doc/libs/1_35_0/libs/serialization/doc/index.html, thus reading serialized instance with its id/key.
The implementation that i know is saving instances to a file and then loading them all according to the saving order. Is there a way to read only one selected instance from the file.
How about serializing objects separately? I mean instead of saving a object and its children objects into a big file, simply saving them into different files. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
boost-users-bounces@lists.boost.org on Wednesday, July 16, 2008 2:06 PM:
The problem with this solution is that it is time consuming, to open file for a key, i would like to use the boost serializeation to improve time preformance.
What is realy required is some mechanism, to identify an instance according to its key and only than read its data. Thus reading only the required instnace (accordig to its key) and not also the previous data at the file, someting like seek.
I hoped that "XML boost" can supply someting like that, but could not find how.
Hi Ariella! It's not there. boost::archive works sequentially on a stream and that's it, so if you need to skip large portions of data you will have to divide your data into multiple files and/or multiple chunks in one stream. I did the latter and it works fine if you build some kind of meta-information structure on where chunks begin and end. This enables you to seek a specific chunk of data and process that with an archive. In any case, if you want to improve performance of your app use (portable) binary instead of xml archives! Good luck, -- Christian Pfligersdorffer Software Engineering http://www.eos.info
ari vol wrote:
The problem with this solution is that it is time consuming, to open file for a key, i would like to use the boost serializeation to improve time preformance.
What is realy required is some mechanism, to identify an instance according to its key and only than read its data. Thus reading only the required instnace (accordig to its key) and not also the previous data at the file, someting like seek.
It sounds as though you're describing a database. Try storing your serialized output into a row of a database, with the key of interest.
To do what you want to do would require an enhancement to xml_iarchive
and perhaps xml_oarchive as well. Doable, but to do it one would
have to understand the implemenation of the library more than
a casual user would want to.
Robert Ramey
"ari vol"
participants (4)
-
ari vol
-
Nat Goodspeed
-
Pfligersdorffer, Christian
-
Robert Ramey