On Mon, Nov 17, 2008 at 11:07 PM, nobody <[EMAIL PROTECTED]> wrote: > > "Bill Baxter" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On Mon, Nov 17, 2008 at 5:53 AM, Denis Koroskin <[EMAIL PROTECTED]> wrote: >>> 16.11.08 в 18:55 nobody в своём письме писал(а): >>> >>>> I would like to be able to save and load a lot of data to/from a file. >>>> (in >>>> D1) >>>> For example a struct like this: >>>> >>>> struct Fruit >>>> { >>>> int banana; >>>> double[][] orange; >>>> bool[] apple; >>>> } >>>> >>>> Practically all the examples that I've come across only deal with saving >>>> and >>>> loading text, so I'm having a hard time dealing with saving/loading >>>> arrays/floats/bools/etc. >>>> >>>> What would be a good way to do this? >>>> >>>> >>> >>> I know there is a doost.serializer >>> (http://dsource.org/projects/doost/wiki/Serializer) but I never used it >>> myself so I can't say whether it fill fit you. >>> I am also prototyping another one at the moment, but I don't know how far >>> will it take. >>> >> >> team0xf has a library called xpose >> which does serialization to and from a binary format. >> >> Can be found here: >> http://team0xf.com:8080/xf/file/1eb43f0657ec/xpose/ >> >> It's part of xf, which you can get using hg: >> hg clone http://team0xf.com:8080/xf >> >> >> --bb >> > > Oh, I've also used some other team0xf stuff, and that worked splendidly, so > I'll check it out. > Thanks.
I should mention that it's not quite done yet. But many fairly tricky things do work already. For instance, I'm pretty sure that de-serialization of subclasses was working properly last I tried it. That is, if you write out a Derived, and then try to read back a Base, the Base you get back will actually be a pointer to a Derived. And if you write out the same instance multiple times it only gets saved once, and gets loaded back just once also, and the other N-1 copies are just a copy of the pointer to the one loaded instance. I'm pretty sure all that was working last time I tried it. There was something it couldn't do that I was wanting, but I don't quite recall now... On the down side, it's not exactly easy code to extend and/or debug. --bb
