Re: [Boost-users] testing archive version of boost::serialize
Hi Robert Thanks for replying. I realize perhaps I was not clear or do not fully understand your answer. I was not really looking for ways to test my archive class. Let's say I know I have an archive file that's been generated by my archival class, but it has an indeterminate version that may or may not be compatible with the present version. In order for me to determine the embedded version of the archive, the only way I know of is to just attempt to deserialize (I do this using (archive-stream)
(object) ; ) and seeing if a version incompatability is flagged. However, is there any way to determine just from an open archive stream what the version number of the embedded stream or classes implied by the stream contains?
Sam
Check the documentation section Reference/Archive Class Reference/Testing
This explains how you can submit your archive class to the exhaustive series of tests that all the "built-in" archives are subjected to. It does take a while to run the tests. And then it makes even more time to get your custom archive to pass all the tests. But you will be rewarded with something you should be able to depend upon.
Robert Ramey
-- -- Sam Appleton CEO, Ausdia Inc. o: (408) 914 2704 x801 f: (408) 914 2704 c: (650) 242 2908 Email sam@ausdia.com Skype samsappleton
Sam Appleton wrote:
Hi Robert
However, is there any
way to determine just from an open archive stream what the version number of the embedded stream or classes implied by the stream contains?
yes - look at the implementation of the current archives. You'll see that at the very begining, there is "archive version number". This is distinct from the "class version" described for serializable classes. This archive version number can be used to just abort the process, or adjust it's behavior in accordance with the difference between the version which made the archive and the current code version. Robert Ramey
participants (2)
-
Robert Ramey
-
Sam Appleton