Boost logo

Boost Users :

From: Bill Lear (rael_at_[hidden])
Date: 2007-10-18 12:32:23


On Thursday, October 18, 2007 at 09:01:06 (-0700) Robert Ramey writes:
>This would be something that would be better to do yourself. Here is a
>suggestion:
>
>Suppose you've got
>
>class A {
> B b;
> C c;
> D d;
>};

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. If compressed, then you'll have to fudge things,
dividing the bytes by some heuristic factor...

Bill


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