2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
class Speed
|
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
|
|
|
Speed() :
|
|
|
|
_Bps(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
double KBps() const;
|
|
|
|
|
|
|
|
int Bps() const
|
|
|
|
{
|
|
|
|
return _Bps;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isZero() const
|
|
|
|
{
|
|
|
|
return _Bps == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Speed fromKBps(double KBps);
|
|
|
|
|
|
|
|
static Speed fromBps(int Bps)
|
|
|
|
{
|
|
|
|
return Speed(Bps);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setBps(int Bps)
|
|
|
|
{
|
|
|
|
_Bps = Bps;
|
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
Speed& operator +=(Speed const& that)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
_Bps += that._Bps;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
Speed operator +(Speed const& that) const
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return Speed(_Bps + that._Bps);
|
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
bool operator <(Speed const& that) const
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return _Bps < that._Bps;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Speed(int Bps) :
|
|
|
|
_Bps(Bps)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-06-12 22:12:12 +00:00
|
|
|
int _Bps;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|