X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8e80bb9cec2c90dd61f810fb1525932a434288eb..43ac308ea20014761481bc40525496a0bb1d9740:/projects/stargazer/tariffs_impl.cpp diff --git a/projects/stargazer/tariffs_impl.cpp b/projects/stargazer/tariffs_impl.cpp index 9cc829dd..116570d3 100644 --- a/projects/stargazer/tariffs_impl.cpp +++ b/projects/stargazer/tariffs_impl.cpp @@ -47,7 +47,6 @@ TariffsImpl::TariffsImpl(Store * st) WriteServLog(Logger::get()), noTariff(NO_TARIFF_NAME) { -ReadTariffs(); } //----------------------------------------------------------------------------- int TariffsImpl::ReadTariffs() @@ -176,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(), @@ -224,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()); @@ -250,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); -} -//-----------------------------------------------------------------------------