From a095f18afd3ffdc695ebe984a0ad0c74d61fd834 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Wed, 31 Aug 2011 12:59:52 +0300 Subject: [PATCH] Assignement and comparsion operators removed from admin and tariff iface --- include/stg/admin.h | 7 ------- include/stg/tariff.h | 5 ----- projects/stargazer/admin_impl.cpp | 24 ++++++++++++------------ projects/stargazer/admin_impl.h | 12 ++++++------ projects/stargazer/tariff_impl.cpp | 6 +++--- projects/stargazer/tariff_impl.h | 8 ++++---- 6 files changed, 25 insertions(+), 37 deletions(-) diff --git a/include/stg/admin.h b/include/stg/admin.h index 7095bb62..c5baf519 100644 --- a/include/stg/admin.h +++ b/include/stg/admin.h @@ -28,13 +28,6 @@ class ADMIN { public: - virtual ADMIN & operator=(const ADMIN &) = 0; - virtual ADMIN & operator=(const ADMIN_CONF &) = 0; - virtual bool operator==(const ADMIN & rhs) const = 0; - virtual bool operator!=(const ADMIN & rhs) const = 0; - virtual bool operator<(const ADMIN & rhs) const = 0; - virtual bool operator<=(const ADMIN & rhs) const = 0; - virtual const std::string & GetPassword() const = 0; virtual const std::string & GetLogin() const = 0; virtual PRIV const * GetPriv() const = 0; diff --git a/include/stg/tariff.h b/include/stg/tariff.h index b19ec476..189dde59 100644 --- a/include/stg/tariff.h +++ b/include/stg/tariff.h @@ -46,11 +46,6 @@ public: virtual int64_t GetTraffByType(uint64_t up, uint64_t down) const = 0; virtual int GetThreshold(int dir) const = 0; virtual const TARIFF_DATA & GetTariffData() const = 0; - - virtual TARIFF & operator=(const TARIFF_DATA & td) = 0; - virtual TARIFF & operator=(const TARIFF & t) = 0; - virtual bool operator==(const TARIFF & rhs) const = 0; - virtual bool operator!=(const TARIFF & rhs) const = 0; }; #endif diff --git a/projects/stargazer/admin_impl.cpp b/projects/stargazer/admin_impl.cpp index 7f1b301f..3d2c4895 100644 --- a/projects/stargazer/admin_impl.cpp +++ b/projects/stargazer/admin_impl.cpp @@ -58,40 +58,40 @@ ADMIN_IMPL::ADMIN_IMPL(const PRIV & priv, { } //----------------------------------------------------------------------------- -ADMIN & ADMIN_IMPL::operator=(const ADMIN & adm) +ADMIN_IMPL & ADMIN_IMPL::operator=(const ADMIN_IMPL & adm) { if (&adm == this) return *this; -conf = adm.GetConf(); -ip = adm.GetIP(); +conf = adm.conf; +ip = adm.ip; return *this; } //----------------------------------------------------------------------------- -ADMIN & ADMIN_IMPL::operator=(const ADMIN_CONF & ac) +ADMIN_IMPL & ADMIN_IMPL::operator=(const ADMIN_CONF & ac) { conf = ac; return *this; } //----------------------------------------------------------------------------- -bool ADMIN_IMPL::operator==(const ADMIN & rhs) const +bool ADMIN_IMPL::operator==(const ADMIN_IMPL & rhs) const { -return conf.login == rhs.GetLogin(); +return conf.login == rhs.conf.login; } //----------------------------------------------------------------------------- -bool ADMIN_IMPL::operator!=(const ADMIN & rhs) const +bool ADMIN_IMPL::operator!=(const ADMIN_IMPL & rhs) const { -return conf.login != rhs.GetLogin(); +return conf.login != rhs.conf.login; } //----------------------------------------------------------------------------- -bool ADMIN_IMPL::operator<(const ADMIN & rhs) const +bool ADMIN_IMPL::operator<(const ADMIN_IMPL & rhs) const { -return conf.login < rhs.GetLogin(); +return conf.login < rhs.conf.login; } //----------------------------------------------------------------------------- -bool ADMIN_IMPL::operator<=(const ADMIN & rhs) const +bool ADMIN_IMPL::operator<=(const ADMIN_IMPL & rhs) const { -return conf.login <= rhs.GetLogin(); +return conf.login <= rhs.conf.login; } //----------------------------------------------------------------------------- std::string ADMIN_IMPL::GetIPStr() const diff --git a/projects/stargazer/admin_impl.h b/projects/stargazer/admin_impl.h index 6d58336e..6a608e11 100644 --- a/projects/stargazer/admin_impl.h +++ b/projects/stargazer/admin_impl.h @@ -47,12 +47,12 @@ public: const std::string & password); virtual ~ADMIN_IMPL() {}; - ADMIN & operator=(const ADMIN &); - ADMIN & operator=(const ADMIN_CONF &); - bool operator==(const ADMIN & rhs) const; - bool operator!=(const ADMIN & rhs) const; - bool operator<(const ADMIN & rhs) const; - bool operator<=(const ADMIN & rhs) const; + ADMIN_IMPL & operator=(const ADMIN_IMPL &); + ADMIN_IMPL & operator=(const ADMIN_CONF &); + bool operator==(const ADMIN_IMPL & rhs) const; + bool operator!=(const ADMIN_IMPL & rhs) const; + bool operator<(const ADMIN_IMPL & rhs) const; + bool operator<=(const ADMIN_IMPL & rhs) const; const std::string & GetPassword() const { return conf.password; }; const std::string & GetLogin() const { return conf.login; }; diff --git a/projects/stargazer/tariff_impl.cpp b/projects/stargazer/tariff_impl.cpp index 63164a27..bf272f31 100644 --- a/projects/stargazer/tariff_impl.cpp +++ b/projects/stargazer/tariff_impl.cpp @@ -36,15 +36,15 @@ #include "stg_timer.h" //----------------------------------------------------------------------------- -TARIFF & TARIFF_IMPL::operator=(const TARIFF_DATA & td) +TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_DATA & td) { tariffData = td; return *this; } //----------------------------------------------------------------------------- -TARIFF & TARIFF_IMPL::operator=(const TARIFF & t) +TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_IMPL & t) { -tariffData = t.GetTariffData(); +tariffData = t.tariffData; return *this; } //----------------------------------------------------------------------------- diff --git a/projects/stargazer/tariff_impl.h b/projects/stargazer/tariff_impl.h index cdfd7112..f33c08af 100644 --- a/projects/stargazer/tariff_impl.h +++ b/projects/stargazer/tariff_impl.h @@ -82,10 +82,10 @@ public: int GetThreshold(int dir) const; const TARIFF_DATA & GetTariffData() const { return tariffData; } - TARIFF & operator=(const TARIFF_DATA & td); - TARIFF & operator=(const TARIFF & t); - bool operator==(const TARIFF & rhs) const { return GetName() == rhs.GetName(); } - bool operator!=(const TARIFF & rhs) const { return GetName() != rhs.GetName(); } + TARIFF_IMPL & operator=(const TARIFF_DATA & td); + TARIFF_IMPL & operator=(const TARIFF_IMPL & t); + bool operator==(const TARIFF_IMPL & rhs) const { return GetName() == rhs.GetName(); } + bool operator!=(const TARIFF_IMPL & rhs) const { return GetName() != rhs.GetName(); } private: TARIFF_DATA tariffData; -- 2.44.2