[serialization] compare two archives?

It appears that the operator == is not supported on an archive. Is there a way to compare two archives for equality without instantiating all objects in the archive and looking at equality of the objects? James

James C. Sutherland wrote:
It appears that the operator == is not supported on an archive.
Is there a way to compare two archives for equality without instantiating all objects in the archive and looking at equality of the objects?
Wouldn't you just compare the underlying storage of the archived data? Such as the resulting file, or string from a ostringstream. Not sure what your are trying to accomplish. Jeff

On Fri, Nov 19, 2010 at 12:55 PM, Jeff Flinn
James C. Sutherland wrote:
It appears that the operator == is not supported on an archive.
Is there a way to compare two archives for equality without instantiating all objects in the archive and looking at equality of the objects?
Wouldn't you just compare the underlying storage of the archived data? Such as the resulting file, or string from a ostringstream.
Not sure what your are trying to accomplish.
Really I just want to compare two archives that I have read in for equality. ifstream file1( tname1.c_str(), std::ios_base::in ); InputArchive ar1(file1); ar1 >> BOOST_SERIALIZATION_NVP(tbl1); ifstream file2( tname2.c_str(), std::ios_base::in ); InputArchive ar2(file2); ar2 >> BOOST_SERIALIZATION_NVP(tbl2); So at this point I could compare file1 and file2 or ar1 ar2 or tbl1 and tbl2. Comparing equality on tbl1 and tbl2 is a bit tedious, so if I could directly compare either the files or the archives that would help. Hopefully that clarifies my question. James

On Fri, Nov 19, 2010 at 1:19 PM, James C. Sutherland < James.Sutherland@utah.edu> wrote:
On Fri, Nov 19, 2010 at 12:55 PM, Jeff Flinn < TriumphSprint2000@hotmail.com> wrote:
James C. Sutherland wrote:
It appears that the operator == is not supported on an archive.
Is there a way to compare two archives for equality without instantiating all objects in the archive and looking at equality of the objects?
Wouldn't you just compare the underlying storage of the archived data? Such as the resulting file, or string from a ostringstream.
Not sure what your are trying to accomplish.
Really I just want to compare two archives that I have read in for equality.
ifstream file1( tname1.c_str(), std::ios_base::in ); InputArchive ar1(file1); ar1 >> BOOST_SERIALIZATION_NVP(tbl1);
ifstream file2( tname2.c_str(), std::ios_base::in ); InputArchive ar2(file2); ar2 >> BOOST_SERIALIZATION_NVP(tbl2);
So at this point I could compare file1 and file2 or ar1 ar2 or tbl1 and tbl2. Comparing equality on tbl1 and tbl2 is a bit tedious, so if I could directly compare either the files or the archives that would help.
Hopefully that clarifies my question.
James
Silly me - apparently ifstream implements an == operator, so that solves my problem. Sorry for the false alarm. James

If you know the length, you could run a crc if you don't need 100%
guarantee they're the same, but only reasonable assurance.
Brian
On Fri, Nov 19, 2010 at 12:19 PM, James C. Sutherland
On Fri, Nov 19, 2010 at 12:55 PM, Jeff Flinn
wrote: James C. Sutherland wrote:
It appears that the operator == is not supported on an archive.
Is there a way to compare two archives for equality without instantiating all objects in the archive and looking at equality of the objects?
Wouldn't you just compare the underlying storage of the archived data? Such as the resulting file, or string from a ostringstream.
Not sure what your are trying to accomplish.
Really I just want to compare two archives that I have read in for equality.
ifstream file1( tname1.c_str(), std::ios_base::in ); InputArchive ar1(file1); ar1 >> BOOST_SERIALIZATION_NVP(tbl1);
ifstream file2( tname2.c_str(), std::ios_base::in ); InputArchive ar2(file2); ar2 >> BOOST_SERIALIZATION_NVP(tbl2);
So at this point I could compare file1 and file2 or ar1 ar2 or tbl1 and tbl2. Comparing equality on tbl1 and tbl2 is a bit tedious, so if I could directly compare either the files or the archives that would help.
Hopefully that clarifies my question.
James
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Brian Budge
-
James C. Sutherland
-
Jeff Flinn