X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..9e321f1d39023f4ba86cd354eda0c347ac15fca2:/projects/stargazer/tariffs_impl.cpp?ds=sidebyside

diff --git a/projects/stargazer/tariffs_impl.cpp b/projects/stargazer/tariffs_impl.cpp
index 9cc829dd..9d9ed208 100644
--- a/projects/stargazer/tariffs_impl.cpp
+++ b/projects/stargazer/tariffs_impl.cpp
@@ -28,16 +28,15 @@
  $Author: faust $
  */
 
-#include <cassert>
-#include <algorithm>
-#include <vector>
+#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 <cassert>
+#include <algorithm>
 
 using STG::TariffsImpl;
 
@@ -47,7 +46,6 @@ TariffsImpl::TariffsImpl(Store * st)
       WriteServLog(Logger::get()),
       noTariff(NO_TARIFF_NAME)
 {
-ReadTariffs();
 }
 //-----------------------------------------------------------------------------
 int TariffsImpl::ReadTariffs()
@@ -176,12 +174,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 +217,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 +237,3 @@ for (; it != tariffs.end(); ++it)
     }
 }
 //-----------------------------------------------------------------------------
-void TariffsImpl::AddNotifierAdd(NotifierBase<TariffData> * n)
-{
-std::lock_guard<std::mutex> lock(m_mutex);
-onAddNotifiers.insert(n);
-}
-//-----------------------------------------------------------------------------
-void TariffsImpl::DelNotifierAdd(NotifierBase<TariffData> * n)
-{
-std::lock_guard<std::mutex> lock(m_mutex);
-onAddNotifiers.erase(n);
-}
-//-----------------------------------------------------------------------------
-void TariffsImpl::AddNotifierDel(NotifierBase<TariffData> * n)
-{
-std::lock_guard<std::mutex> lock(m_mutex);
-onDelNotifiers.insert(n);
-}
-//-----------------------------------------------------------------------------
-void TariffsImpl::DelNotifierDel(NotifierBase<TariffData> * n)
-{
-std::lock_guard<std::mutex> lock(m_mutex);
-onDelNotifiers.erase(n);
-}
-//-----------------------------------------------------------------------------