Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-10-18 14:55:48


If you want to do it for a particular type of archive or applicaiton without
messing up your serialization for all the others you could use

void serialize(my_archive & ar, E & e, const unsigned int version){
 ar & e;
 progress(e);
 }

Then it would only be applied with you included that particular
header. Might be useful for debugging or whatever.

So your problem now is - you've got too many ideas to
choose from.

Robert Ramey

Peter Dimov wrote:
> 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