]> git.stg.codes - stg.git/commitdiff
Initialize some members in initialization lists
authorMaxim Mamontov <faust.madf@gmail.com>
Wed, 14 Sep 2011 15:14:03 +0000 (18:14 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Wed, 14 Sep 2011 15:14:03 +0000 (18:14 +0300)
projects/stargazer/main.cpp
projects/stargazer/traffcounter_impl.cpp
projects/stargazer/traffcounter_impl.h

index 7cab078d87bbe567c680b2021a6442e8312b44f7..5b4a06fcfed7983190781c919d8c72727ae4d714 100644 (file)
@@ -93,8 +93,8 @@ return lhs.GetStopPosition() > rhs.GetStopPosition();
 class STG_STOPPER
 {
 public:
 class STG_STOPPER
 {
 public:
-    STG_STOPPER() { nonstop = true; }
-    bool    GetStatus() const { return nonstop; };
+    STG_STOPPER() : nonstop(true) {}
+    bool    GetStatus() const { return nonstop; }
     #ifdef NO_DAEMON
     void    Stop(const char * __file__, int __line__)
     #else
     #ifdef NO_DAEMON
     void    Stop(const char * __file__, int __line__)
     #else
index ff18a5e2f17c36ee4e17adaccf3cba80793063c9..ae7f1dfbc1a13ecd2596e452a47df7efb2b1403c 100644 (file)
@@ -59,12 +59,21 @@ tcp = 0, udp, icmp, tcp_udp, all
 //-----------------------------------------------------------------------------
 TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn)
     : TRAFFCOUNTER(),
 //-----------------------------------------------------------------------------
 TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn)
     : TRAFFCOUNTER(),
+      rules(),
+      packets(),
+      ip2packets(),
+      dirName(),
       WriteServLog(GetStgLogger()),
       rulesFileName(fn),
       WriteServLog(GetStgLogger()),
       rulesFileName(fn),
+      monitorDir(),
       monitoring(false),
       users(u),
       running(false),
       stopped(true),
       monitoring(false),
       users(u),
       running(false),
       stopped(true),
+      mutex(),
+      thread(),
+      ipBeforeNotifiers(),
+      ipAfterNotifiers(),
       addUserNotifier(*this),
       delUserNotifier(*this)
 {
       addUserNotifier(*this),
       delUserNotifier(*this)
 {
index 225a636e19594d65e5afe6d9fc5e5ea97378ad50..7afada49bfd494d0adabdafa66e354c4685e76b6 100644 (file)
@@ -102,33 +102,47 @@ class TRAFFCOUNTER_IMPL;
 //-----------------------------------------------------------------------------
 class TRF_IP_BEFORE: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
 //-----------------------------------------------------------------------------
 class TRF_IP_BEFORE: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
-                    TRF_IP_BEFORE(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
-                        : PROPERTY_NOTIFIER_BASE<uint32_t>(),
-                          traffCnt(t),
-                          user(u)
-                    {}
-    void            Notify(const uint32_t & oldValue, const uint32_t & newValue);
-    void            SetUser(USER_IMPL * u) { user = u; }
-    USER_IMPL *     GetUser() const { return user; }
+                TRF_IP_BEFORE(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(t),
+                      user(u)
+                {}
+                TRF_IP_BEFORE(const TRF_IP_BEFORE & rvalue)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(rvalue.traffCnt),
+                      user(rvalue.user)
+                {}
+    void        Notify(const uint32_t & oldValue, const uint32_t & newValue);
+    void        SetUser(USER_IMPL * u) { user = u; }
+    USER_IMPL * GetUser() const { return user; }
 
 private:
 
 private:
+    TRF_IP_BEFORE & operator=(const TRF_IP_BEFORE & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
     TRAFFCOUNTER_IMPL & traffCnt;
-    USER_IMPL *         user;
+    USER_IMPL * user;
 };
 //-----------------------------------------------------------------------------
 class TRF_IP_AFTER: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
 };
 //-----------------------------------------------------------------------------
 class TRF_IP_AFTER: public PROPERTY_NOTIFIER_BASE<uint32_t> {
 public:
-                    TRF_IP_AFTER(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
-                        : PROPERTY_NOTIFIER_BASE<uint32_t>(),
-                          traffCnt(t),
-                          user(u)
-                    {}
-    void            Notify(const uint32_t & oldValue, const uint32_t & newValue);
-    void            SetUser(USER_IMPL * u) { user = u; }
-    USER_IMPL *     GetUser() const { return user; }
+                TRF_IP_AFTER(TRAFFCOUNTER_IMPL & t, USER_IMPL * u)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(t),
+                      user(u)
+                {}
+                TRF_IP_AFTER(const TRF_IP_AFTER & rvalue)
+                    : PROPERTY_NOTIFIER_BASE<uint32_t>(),
+                      traffCnt(rvalue.traffCnt),
+                      user(rvalue.user)
+                {}
+    void        Notify(const uint32_t & oldValue, const uint32_t & newValue);
+    void        SetUser(USER_IMPL * u) { user = u; }
+    USER_IMPL * GetUser() const { return user; }
 private:
 private:
+    TRF_IP_AFTER & operator=(const TRF_IP_AFTER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
     TRAFFCOUNTER_IMPL & traffCnt;
-    USER_IMPL *         user;
+    USER_IMPL * user;
 };
 //-----------------------------------------------------------------------------
 class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
 };
 //-----------------------------------------------------------------------------
 class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
@@ -139,7 +153,11 @@ public:
             {}
     virtual ~ADD_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
             {}
     virtual ~ADD_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
+
 private:
 private:
+    ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
+    ADD_USER_NONIFIER & operator=(const ADD_USER_NONIFIER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
@@ -151,7 +169,11 @@ public:
             {}
     virtual ~DEL_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
             {}
     virtual ~DEL_USER_NONIFIER() {}
     void    Notify(const USER_IMPL_PTR & user);
+
 private:
 private:
+    DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
+    DEL_USER_NONIFIER & operator=(const DEL_USER_NONIFIER & rvalue);
+
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------
     TRAFFCOUNTER_IMPL & traffCnt;
 };
 //-----------------------------------------------------------------------------