diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-22 01:10:38 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-22 01:10:38 +0900 |
| commit | 07d270c87e6f9184aea4ca17eb26e466712e8db2 (patch) | |
| tree | 2dfbaa2e0d2ad0f38cb73098608f7d67a64320f8 /src/ServerStatMan.cc | |
| parent | 126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8 (diff) | |
Require -std=c++11 and use std::shared_ptr instead of SharedHandle
Diffstat (limited to 'src/ServerStatMan.cc')
| -rw-r--r-- | src/ServerStatMan.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc index 81ae7db5..ddeca299 100644 --- a/src/ServerStatMan.cc +++ b/src/ServerStatMan.cc @@ -56,19 +56,19 @@ ServerStatMan::ServerStatMan() {} ServerStatMan::~ServerStatMan() {} -SharedHandle<ServerStat> ServerStatMan::find(const std::string& hostname, +std::shared_ptr<ServerStat> ServerStatMan::find(const std::string& hostname, const std::string& protocol) const { - SharedHandle<ServerStat> ss(new ServerStat(hostname, protocol)); + std::shared_ptr<ServerStat> ss(new ServerStat(hostname, protocol)); ServerStatSet::iterator i = serverStats_.find(ss); if(i == serverStats_.end()) { - return SharedHandle<ServerStat>(); + return std::shared_ptr<ServerStat>(); } else { return *i; } } -bool ServerStatMan::add(const SharedHandle<ServerStat>& serverStat) +bool ServerStatMan::add(const std::shared_ptr<ServerStat>& serverStat) { ServerStatSet::iterator i = serverStats_.lower_bound(serverStat); if(i != serverStats_.end() && *(*i) == *serverStat) { @@ -195,7 +195,7 @@ bool ServerStatMan::load(const std::string& filename) if(m[S_HOST].empty() || m[S_PROTOCOL].empty()) { continue; } - SharedHandle<ServerStat> sstat(new ServerStat(m[S_HOST], m[S_PROTOCOL])); + std::shared_ptr<ServerStat> sstat(new ServerStat(m[S_HOST], m[S_PROTOCOL])); uint32_t uintval; if(!util::parseUIntNoThrow(uintval, m[S_DL_SPEED])) { @@ -243,7 +243,7 @@ private: public: FindStaleServerStat(time_t timeout):timeout_(timeout) {} - bool operator()(const SharedHandle<ServerStat>& ss) const + bool operator()(const std::shared_ptr<ServerStat>& ss) const { return ss->getLastUpdated().difference(time_) >= timeout_; } |
