]> git.stg.codes - stg.git/commitdiff
Remove redundand ctors.
authorMaxim Mamontov <faust.madf@gmail.com>
Sun, 18 Feb 2018 17:48:42 +0000 (19:48 +0200)
committerMaxim Mamontov <faust.madf@gmail.com>
Sun, 18 Feb 2018 17:48:42 +0000 (19:48 +0200)
projects/stargazer/admin_impl.cpp
projects/stargazer/admin_impl.h
projects/stargazer/plugins/other/ping/ping.cpp
projects/stargazer/plugins/other/ping/ping.h
projects/stargazer/tariff_impl.cpp
projects/stargazer/tariff_impl.h
projects/stargazer/traffcounter_impl.cpp
projects/stargazer/traffcounter_impl.h

index 400fe5c4a6a8bb14abec25d28ab0ba344ba72d92..9788cec4c76d58af2c4b0fbf2737f53c44847264 100644 (file)
 
 //-----------------------------------------------------------------------------
 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;
index 88f38eb434699722751f8a4ae97900e106fd7e82..22ffa0710573099fe66feb7f07053058233ecbf1 100644 (file)
@@ -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;
index bec692fa400e48bf8fc2a08c9d3b08efa473a98f..040e3faa12ac8172aad5fa3e0f1eeba00d728bc0 100644 (file)
@@ -1,14 +1,15 @@
-#include <cstdio>
-#include <cassert>
-#include <csignal>
-#include <ctime>
-#include <algorithm>
+#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 <cstdio>
+#include <cassert>
+#include <csignal>
+#include <ctime>
+#include <algorithm>
 
 namespace
 {
@@ -17,12 +18,11 @@ PLUGIN_CREATOR<PING> pc;
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-// ëÌÁÓÓ ÄÌÑ ÐÏÉÓËÁ ÀÚÅÒÁ × ÓÐÉÓËÅ ÎÏÔÉÆÉËÁÔÏÒÏ×
 template <typename varType>
-class IS_CONTAINS_USER: public std::binary_function<varType, USER_PTR, bool>
+class HAS_USER: public std::binary_function<varType, USER_PTR, bool>
 {
 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<PING *>(d);
 ping->isRunning = true;
 
 long delay = (10000000 * ping->pingSettings.GetPingDelay()) / 3 + 50000000;
+
 while (ping->nonstop)
     {
     std::list<USER_PTR>::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<CHG_CURRIP_NOTIFIER_PING> IsContainsUserCurrIP(u);
-IS_CONTAINS_USER<CHG_IPS_NOTIFIER_PING> IsContainsUserIP(u);
+HAS_USER<CHG_CURRIP_NOTIFIER_PING> IsContainsUserCurrIP(u);
+HAS_USER<CHG_IPS_NOTIFIER_PING> IsContainsUserIP(u);
 
 std::list<CHG_CURRIP_NOTIFIER_PING>::iterator currIPter;
 std::list<CHG_IPS_NOTIFIER_PING>::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)
index 34bbbc52c5bd407b2e8a7990baa02c3697a0fb40..8b58e7eee2e038c62f02a5f3151a06ab2494232f 100644 (file)
@@ -30,15 +30,12 @@ class SETTINGS;
 class CHG_CURRIP_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
     CHG_CURRIP_NOTIFIER_PING(const PING & p, USER_PTR u)
-        : PROPERTY_NOTIFIER_BASE<uint32_t>(), user(u), ping(p) {}
-    CHG_CURRIP_NOTIFIER_PING(const CHG_CURRIP_NOTIFIER_PING & rvalue)
-        : PROPERTY_NOTIFIER_BASE<uint32_t>(),
-          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<USER_IPS> {
 public:
     CHG_IPS_NOTIFIER_PING(const PING & p, USER_PTR u)
-        : PROPERTY_NOTIFIER_BASE<USER_IPS>(), user(u), ping(p) {}
-    CHG_IPS_NOTIFIER_PING(const CHG_IPS_NOTIFIER_PING & rvalue)
-        : PROPERTY_NOTIFIER_BASE<USER_IPS>(),
-          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<USER_PTR> {
 public:
-    explicit ADD_USER_NONIFIER_PING(PING & p) : NOTIFIER_BASE<USER_PTR>(), 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<USER_PTR> {
 public:
-    explicit DEL_USER_NONIFIER_PING(PING & p) : NOTIFIER_BASE<USER_PTR>(), 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; }
index 7dbae0da5def9330a4a6d01a957cf72b208d36e3..1fa2e82f624e2c06a155d068666ac09b537e6dea 100644 (file)
  $Author: faust $
  */
 
-#include <ctime>
-#include <algorithm> // std::max
-
-#include "stg/common.h"
 #include "tariff_impl.h"
+
 #include "stg_timer.h"
+#include "stg/common.h"
+
+#include <ctime>
+#include <algorithm> // 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,
index 3a12fbdf6769a18047540d6466d1808ff6849cbf..f3accec99a9c86b527bafe36dc3754c965c684a1 100644 (file)
 
 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;
index 8cc08839151a2fb7dde09763468be225251b6729..cd3244eb54f0064cb4d7def50e5f57bb61221cbd 100644 (file)
@@ -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)
     {
index a1dfa74303aa8a4844fcf443550a53b712b4b359..86d8c3898780b481c0355c34385cfabdaaae8469 100644 (file)
@@ -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;