From: Maxim Mamontov Date: Sun, 18 Feb 2018 17:48:42 +0000 (+0200) Subject: Remove redundand ctors. X-Git-Tag: 2.409~20 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/f30167d5f98aa53c747b1e119110fb0acff2651e Remove redundand ctors. --- diff --git a/projects/stargazer/admin_impl.cpp b/projects/stargazer/admin_impl.cpp index 400fe5c4..9788cec4 100644 --- a/projects/stargazer/admin_impl.cpp +++ b/projects/stargazer/admin_impl.cpp @@ -34,15 +34,12 @@ //----------------------------------------------------------------------------- ADMIN_IMPL::ADMIN_IMPL() - : ADMIN(), - conf(), - ip(0) + : ip(0) { } //----------------------------------------------------------------------------- ADMIN_IMPL::ADMIN_IMPL(const ADMIN_CONF & ac) - : ADMIN(), - conf(ac), + : conf(ac), ip(0) { } @@ -50,22 +47,11 @@ ADMIN_IMPL::ADMIN_IMPL(const ADMIN_CONF & ac) ADMIN_IMPL::ADMIN_IMPL(const PRIV & priv, const std::string & login, const std::string & password) - : ADMIN(), - conf(priv, login, password), + : conf(priv, login, password), ip(0) { } //----------------------------------------------------------------------------- -ADMIN_IMPL & ADMIN_IMPL::operator=(const ADMIN_IMPL & adm) -{ -if (&adm == this) - return *this; - -conf = adm.conf; -ip = adm.ip; -return *this; -} -//----------------------------------------------------------------------------- ADMIN_IMPL & ADMIN_IMPL::operator=(const ADMIN_CONF & ac) { conf = ac; diff --git a/projects/stargazer/admin_impl.h b/projects/stargazer/admin_impl.h index 88f38eb4..22ffa071 100644 --- a/projects/stargazer/admin_impl.h +++ b/projects/stargazer/admin_impl.h @@ -46,7 +46,6 @@ public: const std::string & password); virtual ~ADMIN_IMPL() {} - 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; diff --git a/projects/stargazer/plugins/other/ping/ping.cpp b/projects/stargazer/plugins/other/ping/ping.cpp index bec692fa..040e3faa 100644 --- a/projects/stargazer/plugins/other/ping/ping.cpp +++ b/projects/stargazer/plugins/other/ping/ping.cpp @@ -1,14 +1,15 @@ -#include -#include -#include -#include -#include +#include "ping.h" #include "stg/user.h" #include "stg/locker.h" #include "stg/user_property.h" #include "stg/plugin_creator.h" -#include "ping.h" + +#include +#include +#include +#include +#include namespace { @@ -17,12 +18,11 @@ PLUGIN_CREATOR pc; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -// ëÌÁÓÓ ÄÌÑ ÐÏÉÓËÁ ÀÚÅÒÁ × ÓÐÉÓËÅ ÎÏÔÉÆÉËÁÔÏÒÏ× template -class IS_CONTAINS_USER: public std::binary_function +class HAS_USER: public std::binary_function { public: - IS_CONTAINS_USER(const USER_PTR & u) : user(u) {} + explicit HAS_USER(const USER_PTR & u) : user(u) {} bool operator()(varType notifier) const { return notifier.GetUser() == user; @@ -164,7 +164,7 @@ PING * ping = static_cast(d); ping->isRunning = true; long delay = (10000000 * ping->pingSettings.GetPingDelay()) / 3 + 50000000; - + while (ping->nonstop) { std::list::iterator iter = ping->usersList.begin(); @@ -227,8 +227,8 @@ u->GetProperty().ips.AddAfterNotifier(&(*ChgIPNotifierList.begin())); void PING::UnSetUserNotifiers(USER_PTR u) { // --- CurrIP --- -IS_CONTAINS_USER IsContainsUserCurrIP(u); -IS_CONTAINS_USER IsContainsUserIP(u); +HAS_USER IsContainsUserCurrIP(u); +HAS_USER IsContainsUserIP(u); std::list::iterator currIPter; std::list::iterator IPIter; @@ -277,9 +277,7 @@ while (users->SearchNext(h, &u) == 0) { uint32_t ip = u->GetCurrIP(); if (ip) - { pinger.AddIP(ip); - } } } @@ -318,22 +316,16 @@ void CHG_CURRIP_NOTIFIER_PING::Notify(const uint32_t & oldIP, const uint32_t & n { ping.pinger.DelIP(oldIP); if (newIP) - { ping.pinger.AddIP(newIP); - } } //----------------------------------------------------------------------------- void CHG_IPS_NOTIFIER_PING::Notify(const USER_IPS & oldIPS, const USER_IPS & newIPS) { if (oldIPS.OnlyOneIP()) - { ping.pinger.DelIP(oldIPS[0].ip); - } if (newIPS.OnlyOneIP()) - { ping.pinger.AddIP(newIPS[0].ip); - } } //----------------------------------------------------------------------------- void ADD_USER_NONIFIER_PING::Notify(const USER_PTR & user) diff --git a/projects/stargazer/plugins/other/ping/ping.h b/projects/stargazer/plugins/other/ping/ping.h index 34bbbc52..8b58e7ee 100644 --- a/projects/stargazer/plugins/other/ping/ping.h +++ b/projects/stargazer/plugins/other/ping/ping.h @@ -30,15 +30,12 @@ class SETTINGS; class CHG_CURRIP_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE { public: CHG_CURRIP_NOTIFIER_PING(const PING & p, USER_PTR u) - : PROPERTY_NOTIFIER_BASE(), user(u), ping(p) {} - CHG_CURRIP_NOTIFIER_PING(const CHG_CURRIP_NOTIFIER_PING & rvalue) - : PROPERTY_NOTIFIER_BASE(), - user(rvalue.user), ping(rvalue.ping) {} + : user(u), ping(p) {} void Notify(const uint32_t & oldIP, const uint32_t & newIP); USER_PTR GetUser() const { return user; } private: - CHG_CURRIP_NOTIFIER_PING & operator=(const CHG_CURRIP_NOTIFIER_PING & rvalue); + CHG_CURRIP_NOTIFIER_PING & operator=(const CHG_CURRIP_NOTIFIER_PING &); USER_PTR user; const PING & ping; @@ -47,15 +44,12 @@ private: class CHG_IPS_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE { public: CHG_IPS_NOTIFIER_PING(const PING & p, USER_PTR u) - : PROPERTY_NOTIFIER_BASE(), user(u), ping(p) {} - CHG_IPS_NOTIFIER_PING(const CHG_IPS_NOTIFIER_PING & rvalue) - : PROPERTY_NOTIFIER_BASE(), - user(rvalue.user), ping(rvalue.ping) {} + : user(u), ping(p) {} void Notify(const USER_IPS & oldIPS, const USER_IPS & newIPS); USER_PTR GetUser() const { return user; } private: - CHG_IPS_NOTIFIER_PING & operator=(const CHG_IPS_NOTIFIER_PING & rvalue); + CHG_IPS_NOTIFIER_PING & operator=(const CHG_IPS_NOTIFIER_PING &); USER_PTR user; const PING & ping; @@ -63,34 +57,31 @@ private: //----------------------------------------------------------------------------- class ADD_USER_NONIFIER_PING: public NOTIFIER_BASE { public: - explicit ADD_USER_NONIFIER_PING(PING & p) : NOTIFIER_BASE(), ping(p) {} - virtual ~ADD_USER_NONIFIER_PING() {} + explicit ADD_USER_NONIFIER_PING(PING & p) : ping(p) {} void Notify(const USER_PTR & user); private: - ADD_USER_NONIFIER_PING(const ADD_USER_NONIFIER_PING & rvalue); - ADD_USER_NONIFIER_PING & operator=(const ADD_USER_NONIFIER_PING & rvalue); + ADD_USER_NONIFIER_PING(const ADD_USER_NONIFIER_PING &); + ADD_USER_NONIFIER_PING & operator=(const ADD_USER_NONIFIER_PING &); PING & ping; }; //----------------------------------------------------------------------------- class DEL_USER_NONIFIER_PING: public NOTIFIER_BASE { public: - explicit DEL_USER_NONIFIER_PING(PING & p) : NOTIFIER_BASE(), ping(p) {} - virtual ~DEL_USER_NONIFIER_PING() {} + explicit DEL_USER_NONIFIER_PING(PING & p) : ping(p) {} void Notify(const USER_PTR & user); private: - DEL_USER_NONIFIER_PING(const DEL_USER_NONIFIER_PING & rvalue); - DEL_USER_NONIFIER_PING & operator=(const DEL_USER_NONIFIER_PING & rvalue); + DEL_USER_NONIFIER_PING(const DEL_USER_NONIFIER_PING &); + DEL_USER_NONIFIER_PING & operator=(const DEL_USER_NONIFIER_PING &); PING & ping; }; //----------------------------------------------------------------------------- class PING_SETTINGS { public: - PING_SETTINGS() : pingDelay(0), errorStr() {} - virtual ~PING_SETTINGS() {} + PING_SETTINGS() : pingDelay(0) {} const std::string & GetStrError() const { return errorStr; } int ParseSettings(const MODULE_SETTINGS & s); int GetPingDelay() const { return pingDelay; } diff --git a/projects/stargazer/tariff_impl.cpp b/projects/stargazer/tariff_impl.cpp index 7dbae0da..1fa2e82f 100644 --- a/projects/stargazer/tariff_impl.cpp +++ b/projects/stargazer/tariff_impl.cpp @@ -28,12 +28,13 @@ $Author: faust $ */ -#include -#include // std::max - -#include "stg/common.h" #include "tariff_impl.h" + #include "stg_timer.h" +#include "stg/common.h" + +#include +#include // std::max //----------------------------------------------------------------------------- TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_DATA & td) @@ -42,12 +43,6 @@ tariffData = td; return *this; } //----------------------------------------------------------------------------- -TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_IMPL & t) -{ -tariffData = t.tariffData; -return *this; -} -//----------------------------------------------------------------------------- double TARIFF_IMPL::GetPriceWithTraffType(uint64_t up, uint64_t down, int dir, diff --git a/projects/stargazer/tariff_impl.h b/projects/stargazer/tariff_impl.h index 3a12fbdf..f3accec9 100644 --- a/projects/stargazer/tariff_impl.h +++ b/projects/stargazer/tariff_impl.h @@ -45,10 +45,6 @@ class TARIFF_IMPL : public TARIFF { public: - TARIFF_IMPL() - : TARIFF(), - tariffData() - {} explicit TARIFF_IMPL(const std::string & name) : TARIFF(), tariffData(name) @@ -82,7 +78,6 @@ public: const TARIFF_DATA & GetTariffData() const { return tariffData; } 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(); } std::string TariffChangeIsAllowed(const TARIFF & to, time_t currentTime) const; diff --git a/projects/stargazer/traffcounter_impl.cpp b/projects/stargazer/traffcounter_impl.cpp index 8cc08839..cd3244eb 100644 --- a/projects/stargazer/traffcounter_impl.cpp +++ b/projects/stargazer/traffcounter_impl.cpp @@ -59,23 +59,13 @@ tcp = 0, udp, icmp, tcp_udp, all //----------------------------------------------------------------------------- TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn) - : TRAFFCOUNTER(), - rules(), - packets(), - ip2packets(), - dirName(), - WriteServLog(GetStgLogger()), + : WriteServLog(GetStgLogger()), rulesFileName(fn), - monitorDir(), monitoring(false), touchTimeP(stgTime - MONITOR_TIME_DELAY_SEC), users(u), running(false), stopped(true), - mutex(), - thread(), - ipBeforeNotifiers(), - ipAfterNotifiers(), addUserNotifier(*this), delUserNotifier(*this) { @@ -115,9 +105,7 @@ assert(h && "USERS::OpenSearch is always correct"); USER_IMPL * u; while (users->SearchNext(h, &u) == 0) - { SetUserNotifiers(u); - } users->CloseSearch(h); running = true; @@ -142,9 +130,7 @@ assert(h && "USERS::OpenSearch is always correct"); USER_IMPL * u; while (users->SearchNext(h, &u) == 0) - { UnSetUserNotifiers(u); - } users->CloseSearch(h); //5 seconds to thread stops itself @@ -385,7 +371,7 @@ while (pi.first != pi.second) { if (pi.first->second->first.GetSrcIP() == uip) { - assert((!pi.first->second->second.userUPresent || + assert((!pi.first->second->second.userUPresent || pi.first->second->second.userU == user) && "U user present but it's not current user"); @@ -396,7 +382,7 @@ while (pi.first != pi.second) if (pi.first->second->first.GetDstIP() == uip) { - assert((!pi.first->second->second.userDPresent || + assert((!pi.first->second->second.userDPresent || pi.first->second->second.userD == user) && "D user present but it's not current user"); @@ -835,8 +821,6 @@ if (r == 0) rule->ip = ipaddr.s_addr; rule->mask = CalcMask(msk); -//msk = 1; -//printfd(__FILE__, "msk=%d mask=%08X mask=%08X\n", msk, rule->mask, (0xFFffFFff << (32 - msk))); if ((ipaddr.s_addr & rule->mask) != ipaddr.s_addr) { diff --git a/projects/stargazer/traffcounter_impl.h b/projects/stargazer/traffcounter_impl.h index a1dfa743..86d8c389 100644 --- a/projects/stargazer/traffcounter_impl.h +++ b/projects/stargazer/traffcounter_impl.h @@ -73,19 +73,6 @@ PACKET_EXTRA_DATA() lenD(0) {} -PACKET_EXTRA_DATA(const PACKET_EXTRA_DATA & pp) - : flushTime(pp.flushTime), - updateTime(pp.updateTime), - userU(pp.userU), - userUPresent(pp.userUPresent), - userD(pp.userD), - userDPresent(pp.userDPresent), - dirU(pp.dirU), - dirD(pp.dirD), - lenU(pp.lenU), - lenD(pp.lenD) -{} - time_t flushTime; // Last flush time time_t updateTime; // Last update time USER_IMPL * userU; // Uploader @@ -196,8 +183,8 @@ public: size_t RulesCount() const { return rules.size(); } private: - TRAFFCOUNTER_IMPL(const TRAFFCOUNTER_IMPL & rvalue); - TRAFFCOUNTER_IMPL & operator=(const TRAFFCOUNTER_IMPL & rvalue); + TRAFFCOUNTER_IMPL(const TRAFFCOUNTER_IMPL &); + TRAFFCOUNTER_IMPL & operator=(const TRAFFCOUNTER_IMPL &); bool ParseAddress(const char * ta, RULE * rule) const; uint32_t CalcMask(uint32_t msk) const;