Boost logo

Boost Users :

From: Stefan Holzmann (stefan.holzmann_at_[hidden])
Date: 2007-03-26 10:20:08


Hello,

For my application I need to serialize my data distributed into muliple archives and I need a persistent references on objects inside a different archiv. There is one main archiv which has references on other archives.

I was thinking on the following solution (Perhaps there is an easier way).

I think I have to store and load my objects into several steps.

Save:
1. Assign each archiv a unique id. (Build up a archiv map)
2. Assign each object which needs to be referenced a unique id inside the archiv and build up a object map.
3. Serialize the archiv map (e.g. Archiv ID <-> Archiv Filename).
4. Serialize the content of all objects to the archives. If a reference on a objects needs to be stored the id of this object is serialized to the archiv.

The 32bit object ID consists of a archiv ID as high word and the ID of the object within the archiv as low word.
    
Load:
1. Load and create all the objects from the archives.
2. Assign again the object IDs to each object which can be referenced and build up a map (object <-> ID).
3. Resolve the references by looking up the the object address for the stored object id.

I think step 2 could be skipped if the object IDs are stored also.

Whats your opinion on this? Could this work? Any suggestion for implementation?

To assign the object ID's I have to traverse the complete object structure in similar manner than during the serialize process. Is there a way to use the same mechanism but don't write any data to the archives.

Regards,
Stefan

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: www.gmx.net/de/go/mailfooter/topmail-out

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