SpeedCalculator Class Reference

List of all members.

Classes

class  DataArrivalInfo

Public Member Functions

long double estimatedTimeUntilArrival () const
 In seconds.
qint64 expectedDataSize () const
long double getSpeed () const
 In bytes per second.
qint64 lastRegisteredDataAmount () const
 Last amount of data registered through registerDataAmount() method.
qint64 lastRegisterAttemptedDataAmount () const
 Last amount of data that was passed to registerDataAmount().
void registerDataAmount (qint64 totalAmountOfArrivedData)
 Register new total amount of data.
void setExpectedDataSize (qint64 size)
 Maximum expected size of the data.
void start ()
 Clears all values. Prepares SpeedCalculator for new speed measure.

Member Function Documentation

long double SpeedCalculator::estimatedTimeUntilArrival (  )  const

In seconds.

Returns:
A negative value is returned if time cannot be calculated properly.
long double SpeedCalculator::getSpeed (  )  const

In bytes per second.

Returns:
Non-negative value if speed was calculated properly. A negative value if it was impossible to calculate speed.
qint64 SpeedCalculator::lastRegisterAttemptedDataAmount (  )  const [inline]

Last amount of data that was passed to registerDataAmount().

It doesn't matter whether the data was actually registered for the speed calculation or not.

qint64 SpeedCalculator::lastRegisteredDataAmount (  )  const

Last amount of data registered through registerDataAmount() method.

If SpeedCalculator is used properly this will equal to total amount of downloaded data.

void SpeedCalculator::registerDataAmount ( qint64  totalAmountOfArrivedData  ) 

Register new total amount of data.

This will be used to calculate speed and ETA. Internally this will store data only once per second. It is not a problem to call this method more often as in such case it will change no data inside the object of this class.

void SpeedCalculator::setExpectedDataSize ( qint64  size  ) 

Maximum expected size of the data.

This value is used to calculate ETA.

void SpeedCalculator::start (  ) 

Clears all values. Prepares SpeedCalculator for new speed measure.

This will clear arrivalData and dataSizeExpected variables and restart the clock.


The documentation for this class was generated from the following files: