2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
27 #include "stg/tariff.h"
28 #include "stg/tariffs.h"
29 #include "stg/tariff_conf.h"
30 #include "tariff_impl.h"
44 class TariffsImpl : public Tariffs {
46 using Data = std::vector<TariffImpl>;
48 explicit TariffsImpl(Store * store);
50 int ReadTariffs () override;
51 const Tariff * FindByName(const std::string & name) const override;
52 const Tariff * GetNoTariff() const override { return &noTariff; }
53 size_t Count() const override;
54 int Del(const std::string & name, const Admin * admin) override;
55 int Add(const std::string & name, const Admin * admin) override;
56 int Chg(const TariffData & td, const Admin * admin) override;
58 void AddNotifierAdd(NotifierBase<TariffData> * notifier) override;
59 void DelNotifierAdd(NotifierBase<TariffData> * notifier) override;
61 void AddNotifierDel(NotifierBase<TariffData> * notifier) override;
62 void DelNotifierDel(NotifierBase<TariffData> * notifier) override;
64 void GetTariffsData(std::vector<TariffData> * tdl) const override;
66 const std::string & GetStrError() const override { return strError; }
72 mutable std::mutex m_mutex;
76 std::set<NotifierBase<TariffData>*> onAddNotifiers;
77 std::set<NotifierBase<TariffData>*> onDelNotifiers;