Christian Henning wrote:
Robert, thank you so much. Seems to me as a general rule of thumb that serialization is somewhat symmetric.
As far as the data items and types are concerned, its totally symmetric. This is the bedrock on which it is based. This is why: a) archives contain so little information - type/data symetry is presumed. b) versioning is important. archives don't keep much information about themselves. Much of the information is in the C++ data structures and thier serialization functions. c) its hard to edit archives independently of the serialization functions. d) .... some other thngs. The only asymmetry is in some cases loading is not a symmetrical operation to saving due to the nature of the data type. Also, once additional versions are introduced, loading and saving will not be symmetrical. That is, loading needs to load old versions - while saving only needs to save the current one.
I mean if you need to use a base pointer for deserialization you need to use a base pointer when serializing the object. Right?
In general if you save type T you better load type T. This is because a lot of the "magic" is implementing information about the type in the archive. Note that common error that is difficult to find is when the saving an loading of the data is not symmetrical. Example - saving x, y and loading x, y, z. The xml_?archives check for this but other archives - in the interest of speed - trust the programmer.
Thanks again, Christian
Robert Ramey