X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/bc6cac0e474dfe2feb4983aef98f99e23a98ffc4..b27841d687ec9e84983340b5581376dfb24010ea:/projects/stargazer/tariffs_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/tariffs_impl.cpp b/projects/stargazer/tariffs_impl.cpp index 492f403f..792e53da 100644 --- a/projects/stargazer/tariffs_impl.cpp +++ b/projects/stargazer/tariffs_impl.cpp @@ -28,16 +28,16 @@ $Author: faust $ */ -#include -#include -#include +#include "tariffs_impl.h" #include "stg/locker.h" #include "stg/logger.h" #include "stg/store.h" #include "stg/admin.h" #include "stg/admin_conf.h" -#include "tariffs_impl.h" + +#include +#include using STG::TariffsImpl; @@ -175,12 +175,7 @@ TariffData td; tariffs.erase(ti); } -auto ni = onDelNotifiers.begin(); -while (ni != onDelNotifiers.end()) - { - (*ni)->notify(td); - ++ni; - } +m_onDelCallbacks.notify(td); WriteServLog("%s Tariff \'%s\' deleted.", admin->logStr().c_str(), @@ -223,13 +218,7 @@ if (store->AddTariff(name) < 0) return -1; } -// Fire all "on add" notifiers -auto ni = onAddNotifiers.begin(); -while (ni != onAddNotifiers.end()) - { - (*ni)->notify(tariffs.back().GetTariffData()); - ++ni; - } +m_onAddCallbacks.notify(tariffs.back().GetTariffData()); WriteServLog("%s Tariff \'%s\' added.", admin->logStr().c_str(), name.c_str()); @@ -249,27 +238,3 @@ for (; it != tariffs.end(); ++it) } } //----------------------------------------------------------------------------- -void TariffsImpl::AddNotifierAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiers.insert(n); -} -//----------------------------------------------------------------------------- -void TariffsImpl::DelNotifierAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiers.erase(n); -} -//----------------------------------------------------------------------------- -void TariffsImpl::AddNotifierDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiers.insert(n); -} -//----------------------------------------------------------------------------- -void TariffsImpl::DelNotifierDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiers.erase(n); -} -//-----------------------------------------------------------------------------