Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-18 13:24:52


Bill Lear:

> I think something simpler would be to have a single callback,
> say progress(), and pass it the number of bytes read so far
> from the stream in question. This would allow a percentage complete
> calculation to be done based on the number of bytes in the incoming
> file (assuming it is not compressed). Thus, something like this:
>
> template<class Archive>
> void serialize(Archive & ar, E & e, const unsigned int version){
> ar & e;
> progress(ar.stream().tellg());
> }
>
> template<class Archive>
> void serialize(Archive & ar, B & b, const unsigned int version){
> ar & b;
> progress(ar.stream().tellg());
> }
>
> or whatever.

It's better to implement the progress callback at the streambuf level, the
stream level, or the archive level (in decreasing order of betterness.)


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