From: Maksym Mamontov Date: Tue, 23 Aug 2022 11:17:59 +0000 (+0300) Subject: Simplify notifiers. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/bc6cac0e474dfe2feb4983aef98f99e23a98ffc4?ds=sidebyside Simplify notifiers. --- diff --git a/include/stg/notifer.h b/include/stg/notifer.h index 367c5ced..339b6170 100644 --- a/include/stg/notifer.h +++ b/include/stg/notifer.h @@ -3,20 +3,15 @@ namespace STG { -template -struct PropertyNotifierBase -{ - virtual ~PropertyNotifierBase() = default; - - virtual void Notify(const T& oldValue, const T& newValue) = 0; -}; - -template +template struct NotifierBase { virtual ~NotifierBase() = default; - virtual void Notify(const T& value) = 0; + virtual void notify(const Ts&... values) = 0; }; +template +using PropertyNotifierBase = NotifierBase; + } diff --git a/include/stg/user_property.h b/include/stg/user_property.h index 5965a7a6..529d854a 100644 --- a/include/stg/user_property.h +++ b/include/stg/user_property.h @@ -207,14 +207,14 @@ void UserProperty::Set(const T& rvalue) auto ni = beforeNotifiers.begin(); while (ni != beforeNotifiers.end()) - (*ni++)->Notify(oldVal, rvalue); + (*ni++)->notify(oldVal, rvalue); value = rvalue; modificationTime = time(NULL); ni = afterNotifiers.begin(); while (ni != afterNotifiers.end()) - (*ni++)->Notify(oldVal, rvalue); + (*ni++)->notify(oldVal, rvalue); } //----------------------------------------------------------------------------- template diff --git a/projects/stargazer/plugins/authorization/ao/ao.cpp b/projects/stargazer/plugins/authorization/ao/ao.cpp index 7b6f129d..78e1c955 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.cpp +++ b/projects/stargazer/plugins/authorization/ao/ao.cpp @@ -211,7 +211,7 @@ return -1; } //----------------------------------------------------------------------------- template -void CHG_BEFORE_NOTIFIER::Notify(const varParamType &, const varParamType &) +void CHG_BEFORE_NOTIFIER::notify(const varParamType &, const varParamType &) { //EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::Unauthorize, user); if (user->IsAuthorizedBy(&auth)) @@ -219,7 +219,7 @@ if (user->IsAuthorizedBy(&auth)) } //----------------------------------------------------------------------------- template -void CHG_AFTER_NOTIFIER::Notify(const varParamType &, const varParamType &) +void CHG_AFTER_NOTIFIER::notify(const varParamType &, const varParamType &) { //EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::UpdateUserAuthorization, user); auth.UpdateUserAuthorization(user); diff --git a/projects/stargazer/plugins/authorization/ao/ao.h b/projects/stargazer/plugins/authorization/ao/ao.h index dbb2993a..a97a0918 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.h +++ b/projects/stargazer/plugins/authorization/ao/ao.h @@ -51,7 +51,7 @@ public: : user(u), auth(a) {} CHG_BEFORE_NOTIFIER(const CHG_BEFORE_NOTIFIER & rvalue) : user(rvalue.user), auth(rvalue.auth) {} - void Notify(const T & oldValue, const T & newValue); + void notify(const T & oldValue, const T & newValue) override; UserPtr GetUser() const { return user; } private: @@ -68,7 +68,7 @@ public: : user(u), auth(a) {} CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER & rvalue) : user(rvalue.user), auth(rvalue.auth) {} - void Notify(const T & oldValue, const T & newValue); + void notify(const T & oldValue, const T & newValue) override; UserPtr GetUser() const { return user; } private: @@ -125,7 +125,7 @@ private: public: explicit ADD_USER_NONIFIER(AUTH_AO & a) : auth(a) {} virtual ~ADD_USER_NONIFIER() {} - void Notify(const UserPtr & user) { auth.AddUser(user); } + void notify(const UserPtr & user) override { auth.AddUser(user); } private: ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue); @@ -138,7 +138,7 @@ private: public: explicit DEL_USER_NONIFIER(AUTH_AO & a) : auth(a) {} virtual ~DEL_USER_NONIFIER() {} - void Notify(const UserPtr & user) { auth.DelUser(user); } + void notify(const UserPtr & user) override { auth.DelUser(user); } private: DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue); diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h index a5ce8aaf..f9137c20 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h @@ -218,7 +218,7 @@ public: explicit DEL_USER_NOTIFIER(AUTH_IA & a) : auth(a) {} virtual ~DEL_USER_NOTIFIER() {} - void Notify(const UserPtr & user); + void notify(const UserPtr & user) override; private: DEL_USER_NOTIFIER(const DEL_USER_NOTIFIER & rvalue); DEL_USER_NOTIFIER & operator=(const DEL_USER_NOTIFIER & rvalue); @@ -372,7 +372,7 @@ class UnauthorizeUser : std::unary_function & }; //----------------------------------------------------------------------------- inline -void DEL_USER_NOTIFIER::Notify(const UserPtr & user) +void DEL_USER_NOTIFIER::notify(const UserPtr & user) { auth.DelUser(user); } diff --git a/projects/stargazer/plugins/other/ping/ping.cpp b/projects/stargazer/plugins/other/ping/ping.cpp index 260f4aef..35237120 100644 --- a/projects/stargazer/plugins/other/ping/ping.cpp +++ b/projects/stargazer/plugins/other/ping/ping.cpp @@ -291,14 +291,14 @@ while (users_iter != usersList.end()) } } //----------------------------------------------------------------------------- -void CHG_CURRIP_NOTIFIER_PING::Notify(const uint32_t & oldIP, const uint32_t & newIP) +void CHG_CURRIP_NOTIFIER_PING::notify(const uint32_t & oldIP, const uint32_t & newIP) { ping.pinger.DelIP(oldIP); if (newIP != 0) ping.pinger.AddIP(newIP); } //----------------------------------------------------------------------------- -void CHG_IPS_NOTIFIER_PING::Notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) +void CHG_IPS_NOTIFIER_PING::notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) { if (oldIPS.onlyOneIP()) ping.pinger.DelIP(oldIPS[0].ip); @@ -307,12 +307,12 @@ if (newIPS.onlyOneIP()) ping.pinger.AddIP(newIPS[0].ip); } //----------------------------------------------------------------------------- -void ADD_USER_NONIFIER_PING::Notify(const UserPtr & user) +void ADD_USER_NONIFIER_PING::notify(const UserPtr & user) { ping.AddUser(user); } //----------------------------------------------------------------------------- -void DEL_USER_NONIFIER_PING::Notify(const UserPtr & user) +void DEL_USER_NONIFIER_PING::notify(const UserPtr & user) { ping.DelUser(user); } diff --git a/projects/stargazer/plugins/other/ping/ping.h b/projects/stargazer/plugins/other/ping/ping.h index 6a828112..ff66a1c2 100644 --- a/projects/stargazer/plugins/other/ping/ping.h +++ b/projects/stargazer/plugins/other/ping/ping.h @@ -31,7 +31,7 @@ class CHG_CURRIP_NOTIFIER_PING: public STG::PropertyNotifierBase { public: CHG_CURRIP_NOTIFIER_PING(const PING & p, UserPtr u) : user(u), ping(p) {} - void Notify(const uint32_t & oldIP, const uint32_t & newIP); + void notify(const uint32_t & oldIP, const uint32_t & newIP) override; UserPtr GetUser() const { return user; } private: @@ -45,7 +45,7 @@ class CHG_IPS_NOTIFIER_PING: public STG::PropertyNotifierBase { public: CHG_IPS_NOTIFIER_PING(const PING & p, UserPtr u) : user(u), ping(p) {} - void Notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS); + void notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) override; UserPtr GetUser() const { return user; } private: @@ -58,7 +58,7 @@ private: class ADD_USER_NONIFIER_PING: public STG::NotifierBase { public: explicit ADD_USER_NONIFIER_PING(PING & p) : ping(p) {} - void Notify(const UserPtr & user); + void notify(const UserPtr & user) override; private: ADD_USER_NONIFIER_PING(const ADD_USER_NONIFIER_PING &); @@ -70,7 +70,7 @@ private: class DEL_USER_NONIFIER_PING: public STG::NotifierBase { public: explicit DEL_USER_NONIFIER_PING(PING & p) : ping(p) {} - void Notify(const UserPtr & user); + void notify(const UserPtr & user) override; private: DEL_USER_NONIFIER_PING(const DEL_USER_NONIFIER_PING &); diff --git a/projects/stargazer/plugins/other/rscript/rscript.cpp b/projects/stargazer/plugins/other/rscript/rscript.cpp index e675d488..7f0f4bc4 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.cpp +++ b/projects/stargazer/plugins/other/rscript/rscript.cpp @@ -522,7 +522,7 @@ if (it != authorizedUsers.end()) }*/ } //----------------------------------------------------------------------------- -void RS::IP_NOTIFIER::Notify(const uint32_t & /*oldValue*/, const uint32_t & newValue) +void RS::IP_NOTIFIER::notify(const uint32_t & /*oldValue*/, const uint32_t & newValue) { if (newValue != 0) rs.AddRSU(user); @@ -530,7 +530,7 @@ else rs.DelRSU(user); } //----------------------------------------------------------------------------- -void RS::CONNECTED_NOTIFIER::Notify(const bool & /*oldValue*/, const bool & newValue) +void RS::CONNECTED_NOTIFIER::notify(const bool & /*oldValue*/, const bool & newValue) { if (newValue) rs.AddRSU(user); diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index 6c97b598..fc957108 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -63,7 +63,7 @@ class ADD_USER_NONIFIER: public STG::NotifierBase { public: explicit ADD_USER_NONIFIER(REMOTE_SCRIPT & r) : rs(r) {} - void Notify(const UserPtr & user); + void notify(const UserPtr & user) override; private: ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rhs); @@ -76,7 +76,7 @@ class DEL_USER_NONIFIER: public STG::NotifierBase { public: explicit DEL_USER_NONIFIER(REMOTE_SCRIPT & r) : rs(r) {} - void Notify(const UserPtr & user); + void notify(const UserPtr & user) override; private: DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rhs); @@ -101,7 +101,7 @@ public: return *this; } - void Notify(const uint32_t & oldValue, const uint32_t & newValue); + void notify(const uint32_t & oldValue, const uint32_t & newValue) override; UserPtr GetUser() const { return user; } private: @@ -126,7 +126,7 @@ public: return *this; } - void Notify(const bool & oldValue, const bool & newValue); + void notify(const bool & oldValue, const bool & newValue) override; UserPtr GetUser() const { return user; } private: @@ -264,12 +264,12 @@ class DisconnectUser : public std::unary_function(), smux(rvalue.smux), userPtr(rvalue.userPtr) {} - void Notify(const std::string &, const std::string &); + void notify(const std::string &, const std::string &) override; UserPtr GetUserPtr() const { return userPtr; } @@ -85,7 +85,7 @@ class ADD_DEL_TARIFF_NOTIFIER : public STG::NotifierBase { public: explicit ADD_DEL_TARIFF_NOTIFIER(SMUX & s) : STG::NotifierBase(), smux(s) {} - void Notify(const STG::TariffData &); + void notify(const STG::TariffData &) override; private: SMUX & smux; @@ -94,7 +94,7 @@ private: class ADD_USER_NOTIFIER : public STG::NotifierBase { public: explicit ADD_USER_NOTIFIER(SMUX & s) : STG::NotifierBase(), smux(s) {} - void Notify(const UserPtr &); + void notify(const UserPtr &) override; private: SMUX & smux; @@ -103,7 +103,7 @@ private: class DEL_USER_NOTIFIER : public STG::NotifierBase { public: explicit DEL_USER_NOTIFIER(SMUX & s) : STG::NotifierBase(), smux(s) {} - void Notify(const UserPtr &); + void notify(const UserPtr &) override; private: SMUX & smux; @@ -196,26 +196,26 @@ private: //----------------------------------------------------------------------------- inline -void CHG_AFTER_NOTIFIER::Notify(const std::string &, const std::string &) +void CHG_AFTER_NOTIFIER::notify(const std::string &, const std::string &) { smux.UpdateTables(); } inline -void ADD_DEL_TARIFF_NOTIFIER::Notify(const STG::TariffData &) +void ADD_DEL_TARIFF_NOTIFIER::notify(const STG::TariffData &) { smux.UpdateTables(); } inline -void ADD_USER_NOTIFIER::Notify(const UserPtr & userPtr) +void ADD_USER_NOTIFIER::notify(const UserPtr & userPtr) { smux.SetNotifier(userPtr); smux.UpdateTables(); } inline -void DEL_USER_NOTIFIER::Notify(const UserPtr & userPtr) +void DEL_USER_NOTIFIER::notify(const UserPtr & userPtr) { smux.UnsetNotifier(userPtr); smux.UpdateTables(); diff --git a/projects/stargazer/tariffs_impl.cpp b/projects/stargazer/tariffs_impl.cpp index 81f582b2..492f403f 100644 --- a/projects/stargazer/tariffs_impl.cpp +++ b/projects/stargazer/tariffs_impl.cpp @@ -178,7 +178,7 @@ TariffData td; auto ni = onDelNotifiers.begin(); while (ni != onDelNotifiers.end()) { - (*ni)->Notify(td); + (*ni)->notify(td); ++ni; } @@ -227,7 +227,7 @@ if (store->AddTariff(name) < 0) auto ni = onAddNotifiers.begin(); while (ni != onAddNotifiers.end()) { - (*ni)->Notify(tariffs.back().GetTariffData()); + (*ni)->notify(tariffs.back().GetTariffData()); ++ni; } diff --git a/projects/stargazer/traffcounter_impl.h b/projects/stargazer/traffcounter_impl.h index ed639f5c..d23f6306 100644 --- a/projects/stargazer/traffcounter_impl.h +++ b/projects/stargazer/traffcounter_impl.h @@ -97,7 +97,7 @@ public: traffCnt(rvalue.traffCnt), user(rvalue.user) {} - void Notify(const uint32_t & oldValue, const uint32_t & newValue); + void notify(const uint32_t & oldValue, const uint32_t & newValue) override; void SetUser(UserImpl * u) { user = u; } UserImpl * GetUser() const { return user; } @@ -120,7 +120,7 @@ public: traffCnt(rvalue.traffCnt), user(rvalue.user) {} - void Notify(const uint32_t & oldValue, const uint32_t & newValue); + void notify(const uint32_t & oldValue, const uint32_t & newValue) override; void SetUser(UserImpl * u) { user = u; } UserImpl * GetUser() const { return user; } private: @@ -139,7 +139,7 @@ public: traffCnt(t) {} virtual ~ADD_USER_NONIFIER() {} - void Notify(const UserImplPtr & user); + void notify(const UserImplPtr & user) override; private: ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue); @@ -155,7 +155,7 @@ public: traffCnt(t) {} virtual ~DEL_USER_NONIFIER() {} - void Notify(const UserImplPtr & user); + void notify(const UserImplPtr & user) override; private: DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue); @@ -238,7 +238,7 @@ class TraffCounterImpl : public TraffCounter { }; //----------------------------------------------------------------------------- inline -void TRF_IP_BEFORE::Notify(const uint32_t & oldValue, const uint32_t &) +void TRF_IP_BEFORE::notify(const uint32_t & oldValue, const uint32_t &) { // User changes his address. Remove old IP if (!oldValue) @@ -248,7 +248,7 @@ EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::DelUser, oldValue); } //----------------------------------------------------------------------------- inline -void TRF_IP_AFTER::Notify(const uint32_t &, const uint32_t & newValue) +void TRF_IP_AFTER::notify(const uint32_t &, const uint32_t & newValue) { // User changes his address. Add new IP if (!newValue) @@ -258,13 +258,13 @@ EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::AddUser, user); } //----------------------------------------------------------------------------- inline -void ADD_USER_NONIFIER::Notify(const UserImplPtr & user) +void ADD_USER_NONIFIER::notify(const UserImplPtr & user) { EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::SetUserNotifiers, user); } //----------------------------------------------------------------------------- inline -void DEL_USER_NONIFIER::Notify(const UserImplPtr & user) +void DEL_USER_NONIFIER::notify(const UserImplPtr & user) { EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::UnSetUserNotifiers, user); EVENT_LOOP::instance().Enqueue(traffCnt, &TraffCounterImpl::DelUser, user->GetCurrIP()); diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index f5f4c4b4..60e801b9 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -1493,7 +1493,7 @@ std::string UserImpl::GetParamValue(const std::string & name) const //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void STG::CHG_PASSIVE_NOTIFIER::Notify(const int & oldPassive, const int & newPassive) +void STG::CHG_PASSIVE_NOTIFIER::notify(const int & oldPassive, const int & newPassive) { if (newPassive && !oldPassive && user->tariff != NULL) user->properties.cash.Set(user->cash - user->tariff->GetPassiveCost(), @@ -1503,7 +1503,7 @@ if (newPassive && !oldPassive && user->tariff != NULL) "Freeze"); } //----------------------------------------------------------------------------- -void STG::CHG_DISABLED_NOTIFIER::Notify(const int & oldValue, const int & newValue) +void STG::CHG_DISABLED_NOTIFIER::notify(const int & oldValue, const int & newValue) { if (oldValue && !newValue && user->GetConnected()) user->Disconnect(false, "disabled"); @@ -1511,7 +1511,7 @@ else if (!oldValue && newValue && user->IsInetable()) user->Connect(false); } //----------------------------------------------------------------------------- -void STG::CHG_TARIFF_NOTIFIER::Notify(const std::string &, const std::string & newTariff) +void STG::CHG_TARIFF_NOTIFIER::notify(const std::string &, const std::string & newTariff) { STG_LOCKER lock(&user->mutex); if (user->settings->GetReconnectOnTariffChange() && user->connected) @@ -1527,13 +1527,13 @@ if (user->settings->GetReconnectOnTariffChange() && } } //----------------------------------------------------------------------------- -void STG::CHG_CASH_NOTIFIER::Notify(const double & oldCash, const double & newCash) +void STG::CHG_CASH_NOTIFIER::notify(const double & oldCash, const double & newCash) { user->lastCashAddTime = *const_cast(&stgTime); user->lastCashAdd = newCash - oldCash; } //----------------------------------------------------------------------------- -void STG::CHG_IPS_NOTIFIER::Notify(const UserIPs & from, const UserIPs & to) +void STG::CHG_IPS_NOTIFIER::notify(const UserIPs & from, const UserIPs & to) { printfd(__FILE__, "Change IP from '%s' to '%s'\n", from.toString().c_str(), to.toString().c_str()); if (user->connected) diff --git a/projects/stargazer/user_impl.h b/projects/stargazer/user_impl.h index 2e254d63..4beeb2e2 100644 --- a/projects/stargazer/user_impl.h +++ b/projects/stargazer/user_impl.h @@ -54,7 +54,7 @@ class SettingsImpl; class CHG_PASSIVE_NOTIFIER : public PropertyNotifierBase { public: explicit CHG_PASSIVE_NOTIFIER(UserImpl * u) : user(u) {} - void Notify(const int & oldPassive, const int & newPassive); + void notify(const int & oldPassive, const int & newPassive) override; private: UserImpl * user; @@ -63,7 +63,7 @@ class CHG_PASSIVE_NOTIFIER : public PropertyNotifierBase { class CHG_DISABLED_NOTIFIER : public PropertyNotifierBase { public: explicit CHG_DISABLED_NOTIFIER(UserImpl * u) : user(u) {} - void Notify(const int & oldValue, const int & newValue); + void notify(const int & oldValue, const int & newValue) override; private: UserImpl * user; @@ -72,7 +72,7 @@ private: class CHG_TARIFF_NOTIFIER : public PropertyNotifierBase { public: explicit CHG_TARIFF_NOTIFIER(UserImpl * u) : user(u) {} - void Notify(const std::string & oldTariff, const std::string & newTariff); + void notify(const std::string & oldTariff, const std::string & newTariff) override; private: UserImpl * user; @@ -81,7 +81,7 @@ private: class CHG_CASH_NOTIFIER : public PropertyNotifierBase { public: explicit CHG_CASH_NOTIFIER(UserImpl * u) : user(u) {} - void Notify(const double & oldCash, const double & newCash); + void notify(const double & oldCash, const double & newCash) override; private: UserImpl * user; @@ -90,7 +90,7 @@ private: class CHG_IPS_NOTIFIER : public PropertyNotifierBase { public: explicit CHG_IPS_NOTIFIER(UserImpl * u) : user(u) {} - void Notify(const UserIPs & oldIPs, const UserIPs & newIPs); + void notify(const UserIPs & oldIPs, const UserIPs & newIPs) override; private: UserImpl * user; diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index 8cb9bee5..cfd692c5 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -154,7 +154,7 @@ AddUserIntoIndexes(users.begin()); auto ni = onAddNotifiers.begin(); while (ni != onAddNotifiers.end()) { - (*ni)->Notify(&users.front()); + (*ni)->notify(&users.front()); ++ni; } } @@ -164,7 +164,7 @@ AddUserIntoIndexes(users.begin()); auto ni = onAddNotifiersImpl.begin(); while (ni != onAddNotifiersImpl.end()) { - (*ni)->Notify(&users.front()); + (*ni)->notify(&users.front()); ++ni; } } @@ -203,7 +203,7 @@ if (priv.userAddDel == 0) auto ni = onDelNotifiers.begin(); while (ni != onDelNotifiers.end()) { - (*ni)->Notify(&(*u)); + (*ni)->notify(&(*u)); ++ni; } } @@ -212,7 +212,7 @@ if (priv.userAddDel == 0) auto ni = onDelNotifiersImpl.begin(); while (ni != onDelNotifiersImpl.end()) { - (*ni)->Notify(&(*u)); + (*ni)->notify(&(*u)); ++ni; } } diff --git a/tests/test_reconnect_on_tariff_change.cpp b/tests/test_reconnect_on_tariff_change.cpp index ca03d6c2..c47bc1fd 100644 --- a/tests/test_reconnect_on_tariff_change.cpp +++ b/tests/test_reconnect_on_tariff_change.cpp @@ -32,7 +32,7 @@ class AfterConnectedNotifier : public STG::PropertyNotifierBase m_disconnects(0) {} - void Notify(const bool& oldValue, const bool& newValue) override + void notify(const bool& oldValue, const bool& newValue) override { if (!oldValue && newValue) ++m_connects;