diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-09 09:59:56 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-09 09:59:56 +0000 |
| commit | 26690f692b3c242208740b7befade9898fe63e39 (patch) | |
| tree | 28a0c69b87e7fdc35e99fcf0403b4d794364e630 /src/ServerStat.cc | |
| parent | 70b457da0192695754fb1e95f3f81a15dbb0fa78 (diff) | |
2008-08-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented ServerStatMan::save(...) function and its test case.
* src/ServerStat.cc
* src/ServerStat.h
* src/ServerStatMan.cc
* src/ServerStatMan.h
* test/ServerStatManTest.cc
Diffstat (limited to 'src/ServerStat.cc')
| -rw-r--r-- | src/ServerStat.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ServerStat.cc b/src/ServerStat.cc index d1782c61..196b6866 100644 --- a/src/ServerStat.cc +++ b/src/ServerStat.cc @@ -37,6 +37,11 @@ namespace aria2 { +const std::string ServerStat::STATUS_STRING[] = { + "OK", + "ERROR" +}; + ServerStat::ServerStat(const std::string& hostname, const std::string& protocol) : _hostname(hostname), @@ -56,16 +61,26 @@ const std::string& ServerStat::getProtocol() const return _protocol; } -Time ServerStat::getLastUpdated() const +const Time& ServerStat::getLastUpdated() const { return _lastUpdated; } +void ServerStat::setLastUpdated(const Time& time) +{ + _lastUpdated = time; +} + unsigned int ServerStat::getDownloadSpeed() const { return _downloadSpeed; } +void ServerStat::setDownloadSpeed(unsigned int downloadSpeed) +{ + _downloadSpeed = downloadSpeed; +} + void ServerStat::updateDownloadSpeed(unsigned int downloadSpeed) { _downloadSpeed = downloadSpeed; @@ -126,7 +141,8 @@ std::ostream& operator<<(std::ostream& o, const ServerStat& serverStat) o << "host=" << serverStat.getHostname() << ", " << "protocol=" << serverStat.getProtocol() << ", " << "dl_speed=" << serverStat.getDownloadSpeed() << ", " - << "status=" << serverStat.getStatus() << "\n"; + << "last_updated=" << serverStat.getLastUpdated().getTime() << ", " + << "status=" << ServerStat::STATUS_STRING[serverStat.getStatus()]; return o; } |
