- }
-
- DIRPRICE_DATA GetData()
- {
- DIRPRICE_DATA dd;
- dd.hDay = hDay;
- dd.hNight = hNight;
- dd.mDay = mDay;
- dd.mNight = mNight;
- dd.noDiscount = noDiscount;
- dd.priceDayA = priceDayA;
- dd.priceDayB = priceDayB;
-
- dd.priceNightA = priceNightA;
- dd.priceNightB = priceNightB;
- dd.singlePrice = singlePrice;
- dd.threshold = threshold;
- return dd;
- }
-
- RESETABLE<int> hDay;
- RESETABLE<int> mDay;
- RESETABLE<int> hNight;
- RESETABLE<int> mNight;
- RESETABLE<double> priceDayA;
- RESETABLE<double> priceNightA;
- RESETABLE<double> priceDayB;
- RESETABLE<double> priceNightB;
- RESETABLE<int> threshold;
- RESETABLE<int> singlePrice;
- RESETABLE<int> noDiscount;
+ }
+
+ void splice(const DirPriceDataOpt & rhs) noexcept
+ {
+ STG::splice(hDay, rhs.hDay);
+ STG::splice(mDay, rhs.mDay);
+ STG::splice(hNight, rhs.hNight);
+ STG::splice(mNight, rhs.mNight);
+ STG::splice(priceDayA, rhs.priceDayA);
+ STG::splice(priceNightA, rhs.priceNightA);
+ STG::splice(priceDayB, rhs.priceDayB);
+ STG::splice(priceNightB, rhs.priceNightB);
+ STG::splice(threshold, rhs.threshold);
+ STG::splice(singlePrice, rhs.singlePrice);
+ STG::splice(noDiscount, rhs.noDiscount);
+ }
+
+ DirPriceData get(const DirPriceData& defaultValue) const noexcept
+ {
+ DirPriceData res;
+ res.hDay = hDay.value_or(defaultValue.hDay);
+ res.mDay = mDay.value_or(defaultValue.mDay);
+ res.hNight = hNight.value_or(defaultValue.hNight);
+ res.mNight = mNight.value_or(defaultValue.mNight);
+ res.priceDayA = priceDayA.value_or(defaultValue.priceDayA);
+ res.priceNightA = priceNightA.value_or(defaultValue.priceNightA);
+ res.priceDayB = priceDayB.value_or(defaultValue.priceDayB);
+ res.priceNightB = priceNightB.value_or(defaultValue.priceNightB);
+ res.threshold = threshold.value_or(defaultValue.threshold);
+ res.singlePrice = singlePrice.value_or(defaultValue.singlePrice);
+ res.noDiscount = noDiscount.value_or(defaultValue.noDiscount);
+ return res;
+ }
+
+ std::optional<int> hDay;
+ std::optional<int> mDay;
+ std::optional<int> hNight;
+ std::optional<int> mNight;
+ std::optional<double> priceDayA;
+ std::optional<double> priceNightA;
+ std::optional<double> priceDayB;
+ std::optional<double> priceNightB;
+ std::optional<int> threshold;
+ std::optional<int> singlePrice;
+ std::optional<int> noDiscount;