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 $
31 #include "resetable.h"
37 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
70 int singlePrice; // Do not use day/night division
71 int noDiscount; // Do not use threshold
73 //-----------------------------------------------------------------------------
74 struct DIRPRICE_DATA_RES
90 DIRPRICE_DATA_RES & operator= (const DIRPRICE_DATA & rvalue)
94 hNight = rvalue.hNight;
95 mNight = rvalue.mNight;
96 priceDayA = rvalue.priceDayA;
97 priceNightA = rvalue.priceNightA;
98 priceDayB = rvalue.priceDayB;
99 priceNightB = rvalue.priceNightB;
100 threshold = rvalue.threshold;
101 singlePrice = rvalue.singlePrice;
102 noDiscount = rvalue.noDiscount;
106 DIRPRICE_DATA GetData() const
109 dd.hDay = hDay.data();
110 dd.hNight = hNight.data();
111 dd.mDay = mDay.data();
112 dd.mNight = mNight.data();
113 dd.noDiscount = noDiscount.data();
114 dd.priceDayA = priceDayA.data();
115 dd.priceDayB = priceDayB.data();
117 dd.priceNightA = priceNightA.data();
118 dd.priceNightB = priceNightB.data();
119 dd.singlePrice = singlePrice.data();
120 dd.threshold = threshold.data();
126 RESETABLE<int> hNight;
127 RESETABLE<int> mNight;
128 RESETABLE<double> priceDayA;
129 RESETABLE<double> priceNightA;
130 RESETABLE<double> priceDayB;
131 RESETABLE<double> priceNightB;
132 RESETABLE<int> threshold;
133 RESETABLE<int> singlePrice;
134 RESETABLE<int> noDiscount;
136 //-----------------------------------------------------------------------------
144 TARIFF::PERIOD period;
149 traffType(TRAFF_UP_DOWN),
152 period(TARIFF::MONTH)
155 TARIFF_CONF(const std::string & n)
158 traffType(TRAFF_UP_DOWN),
161 period(TARIFF::MONTH)
164 //-----------------------------------------------------------------------------
165 struct TARIFF_CONF_RES
176 TARIFF_CONF_RES & operator=(const TARIFF_CONF & tc)
180 traffType = tc.traffType;
181 passiveCost = tc.passiveCost;
187 TARIFF_CONF GetData() const
191 tc.free = free.data();
192 tc.name = name.data();
193 tc.passiveCost = passiveCost.data();
194 tc.traffType = traffType.data();
195 tc.period = period.data();
199 RESETABLE<double> fee;
200 RESETABLE<double> free;
201 RESETABLE<int> traffType;
202 RESETABLE<double> passiveCost;
203 RESETABLE<std::string> name;
204 RESETABLE<TARIFF::PERIOD> period;
206 //-----------------------------------------------------------------------------
209 TARIFF_CONF tariffConf;
210 std::vector<DIRPRICE_DATA> dirPrice;
217 TARIFF_DATA(const std::string & name)
222 TARIFF_DATA(const TARIFF_DATA & td)
223 : tariffConf(td.tariffConf),
224 dirPrice(td.dirPrice)
227 TARIFF_DATA & operator=(const TARIFF_DATA & td)
229 tariffConf = td.tariffConf;
230 dirPrice = td.dirPrice;
234 //-----------------------------------------------------------------------------
235 struct TARIFF_DATA_RES
237 TARIFF_CONF_RES tariffConf;
238 std::vector<DIRPRICE_DATA_RES> dirPrice;
245 TARIFF_DATA GetData() const
248 td.tariffConf = tariffConf.GetData();
249 for (size_t i = 0; i < DIR_NUM; i++)
250 td.dirPrice[i] = dirPrice[i].GetData();
254 //-----------------------------------------------------------------------------