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();
124 void Splice(const DIRPRICE_DATA_RES & rhs)
126 hDay.splice(rhs.hDay);
127 mDay.splice(rhs.mDay);
128 hNight.splice(rhs.hNight);
129 mNight.splice(rhs.mNight);
130 priceDayA.splice(rhs.priceDayA);
131 priceNightA.splice(rhs.priceNightA);
132 priceDayB.splice(rhs.priceDayB);
133 priceNightB.splice(rhs.priceNightB);
134 threshold.splice(rhs.threshold);
135 singlePrice.splice(rhs.singlePrice);
136 noDiscount.splice(rhs.noDiscount);
141 RESETABLE<int> hNight;
142 RESETABLE<int> mNight;
143 RESETABLE<double> priceDayA;
144 RESETABLE<double> priceNightA;
145 RESETABLE<double> priceDayB;
146 RESETABLE<double> priceNightB;
147 RESETABLE<int> threshold;
148 RESETABLE<int> singlePrice;
149 RESETABLE<int> noDiscount;
151 //-----------------------------------------------------------------------------
159 TARIFF::PERIOD period;
164 traffType(TRAFF_UP_DOWN),
167 period(TARIFF::MONTH)
170 TARIFF_CONF(const std::string & n)
173 traffType(TRAFF_UP_DOWN),
176 period(TARIFF::MONTH)
179 //-----------------------------------------------------------------------------
180 struct TARIFF_CONF_RES
191 TARIFF_CONF_RES & operator=(const TARIFF_CONF & tc)
195 traffType = tc.traffType;
196 passiveCost = tc.passiveCost;
202 TARIFF_CONF GetData() const
206 tc.free = free.data();
207 tc.name = name.data();
208 tc.passiveCost = passiveCost.data();
209 tc.traffType = traffType.data();
210 tc.period = period.data();
214 RESETABLE<double> fee;
215 RESETABLE<double> free;
216 RESETABLE<int> traffType;
217 RESETABLE<double> passiveCost;
218 RESETABLE<std::string> name;
219 RESETABLE<TARIFF::PERIOD> period;
221 //-----------------------------------------------------------------------------
224 TARIFF_CONF tariffConf;
225 std::vector<DIRPRICE_DATA> dirPrice;
232 TARIFF_DATA(const std::string & name)
237 TARIFF_DATA(const TARIFF_DATA & td)
238 : tariffConf(td.tariffConf),
239 dirPrice(td.dirPrice)
242 TARIFF_DATA & operator=(const TARIFF_DATA & td)
244 tariffConf = td.tariffConf;
245 dirPrice = td.dirPrice;
249 //-----------------------------------------------------------------------------
250 struct TARIFF_DATA_RES
252 TARIFF_CONF_RES tariffConf;
253 std::vector<DIRPRICE_DATA_RES> dirPrice;
260 TARIFF_DATA GetData() const
263 td.tariffConf = tariffConf.GetData();
264 for (size_t i = 0; i < DIR_NUM; i++)
265 td.dirPrice[i] = dirPrice[i].GetData();
269 //-----------------------------------------------------------------------------