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
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
23 $Date: 2010/10/05 20:41:11 $
33 #include "resetable.h"
36 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
69 int singlePrice; // Do not use day/night division
70 int noDiscount; // Do not use threshold
72 //-----------------------------------------------------------------------------
73 struct DIRPRICE_DATA_RES
89 DIRPRICE_DATA_RES & operator= (const DIRPRICE_DATA & rvalue)
93 hNight = rvalue.hNight;
94 mNight = rvalue.mNight;
95 priceDayA = rvalue.priceDayA;
96 priceNightA = rvalue.priceNightA;
97 priceDayB = rvalue.priceDayB;
98 priceNightB = rvalue.priceNightB;
99 threshold = rvalue.threshold;
100 singlePrice = rvalue.singlePrice;
101 noDiscount = rvalue.noDiscount;
105 DIRPRICE_DATA GetData() const
108 dd.hDay = hDay.data();
109 dd.hNight = hNight.data();
110 dd.mDay = mDay.data();
111 dd.mNight = mNight.data();
112 dd.noDiscount = noDiscount.data();
113 dd.priceDayA = priceDayA.data();
114 dd.priceDayB = priceDayB.data();
116 dd.priceNightA = priceNightA.data();
117 dd.priceNightB = priceNightB.data();
118 dd.singlePrice = singlePrice.data();
119 dd.threshold = threshold.data();
125 RESETABLE<int> hNight;
126 RESETABLE<int> mNight;
127 RESETABLE<double> priceDayA;
128 RESETABLE<double> priceNightA;
129 RESETABLE<double> priceDayB;
130 RESETABLE<double> priceNightB;
131 RESETABLE<int> threshold;
132 RESETABLE<int> singlePrice;
133 RESETABLE<int> noDiscount;
135 //-----------------------------------------------------------------------------
147 traffType(TRAFF_UP_DOWN),
152 TARIFF_CONF(const std::string & n)
155 traffType(TRAFF_UP_DOWN),
160 //-----------------------------------------------------------------------------
161 struct TARIFF_CONF_RES
171 TARIFF_CONF_RES & operator=(const TARIFF_CONF & tc)
175 traffType = tc.traffType;
176 passiveCost = tc.passiveCost;
181 TARIFF_CONF GetData() const
185 tc.free = free.data();
186 tc.name = name.data();
187 tc.passiveCost = passiveCost.data();
188 tc.traffType = traffType.data();
192 RESETABLE<double> fee;
193 RESETABLE<double> free;
194 RESETABLE<int> traffType;
195 RESETABLE<double> passiveCost;
196 RESETABLE<std::string> name;
198 //-----------------------------------------------------------------------------
201 TARIFF_CONF tariffConf;
202 std::vector<DIRPRICE_DATA> dirPrice;
209 TARIFF_DATA(const std::string & name)
214 TARIFF_DATA(const TARIFF_DATA & td)
215 : tariffConf(td.tariffConf),
216 dirPrice(td.dirPrice)
219 TARIFF_DATA & operator=(const TARIFF_DATA & td)
221 tariffConf = td.tariffConf;
222 dirPrice = td.dirPrice;
226 //-----------------------------------------------------------------------------
227 struct TARIFF_DATA_RES
229 TARIFF_CONF_RES tariffConf;
230 std::vector<DIRPRICE_DATA_RES> dirPrice;
237 TARIFF_DATA GetData() const
240 td.tariffConf = tariffConf.GetData();
241 for (size_t i = 0; i < DIR_NUM; i++)
242 td.dirPrice[i] = dirPrice[i].GetData();
246 //-----------------------------------------------------------------------------