|
|
|
@ -38,34 +38,30 @@
@@ -38,34 +38,30 @@
|
|
|
|
|
template<typename T> |
|
|
|
|
struct Sample |
|
|
|
|
{ |
|
|
|
|
Sample() |
|
|
|
|
: download() |
|
|
|
|
, upload() |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
constexpr Sample() = default; |
|
|
|
|
|
|
|
|
|
Sample(T dl, T ul) |
|
|
|
|
: download(dl) |
|
|
|
|
, upload(ul) |
|
|
|
|
constexpr Sample(const T dl, const T ul) |
|
|
|
|
: download {dl} |
|
|
|
|
, upload {ul} |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Sample<T> &operator+=(const Sample<T> &other) |
|
|
|
|
constexpr Sample<T> &operator+=(const Sample<T> &other) |
|
|
|
|
{ |
|
|
|
|
download += other.download; |
|
|
|
|
upload += other.upload; |
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Sample<T> &operator-=(const Sample<T> &other) |
|
|
|
|
constexpr Sample<T> &operator-=(const Sample<T> &other) |
|
|
|
|
{ |
|
|
|
|
download -= other.download; |
|
|
|
|
upload -= other.upload; |
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
T download; |
|
|
|
|
T upload; |
|
|
|
|
T download {}; |
|
|
|
|
T upload {}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
typedef Sample<qlonglong> SpeedSample; |
|
|
|
|