From: Maxim Mamontov Date: Thu, 29 May 2014 10:20:26 +0000 (+0300) Subject: Added Splice method for resetables. X-Git-Tag: 2.409~321 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/127981f11d5d3553925f01102f7c253e012829b5 Added Splice method for resetables. --- diff --git a/include/stg/resetable.h b/include/stg/resetable.h index c78d0247..8a6ad27c 100644 --- a/include/stg/resetable.h +++ b/include/stg/resetable.h @@ -42,6 +42,14 @@ public: const T & data() const throw() { return value; } bool empty() const throw() { return !is_set; } void reset() throw() { is_set = false; } + void splice(const RESETABLE & rhs) + { + if (rhs.is_set) + { + value = rhs.value; + is_set = true; + } + } private: value_type value; diff --git a/include/stg/tariff_conf.h b/include/stg/tariff_conf.h index 6a296230..fc9807be 100644 --- a/include/stg/tariff_conf.h +++ b/include/stg/tariff_conf.h @@ -121,6 +121,21 @@ struct DIRPRICE_DATA_RES return dd; } + void Splice(const DIRPRICE_DATA_RES & rhs) + { + hDay.splice(rhs.hDay); + mDay.splice(rhs.mDay); + hNight.splice(rhs.hNight); + mNight.splice(rhs.mNight); + priceDayA.splice(rhs.priceDayA); + priceNightA.splice(rhs.priceNightA); + priceDayB.splice(rhs.priceDayB); + priceNightB.splice(rhs.priceNightB); + threshold.splice(rhs.threshold); + singlePrice.splice(rhs.singlePrice); + noDiscount.splice(rhs.noDiscount); + } + RESETABLE hDay; RESETABLE mDay; RESETABLE hNight;