From 127981f11d5d3553925f01102f7c253e012829b5 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 29 May 2014 13:20:26 +0300 Subject: [PATCH] Added Splice method for resetables. --- include/stg/resetable.h | 8 ++++++++ include/stg/tariff_conf.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+) 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; -- 2.43.2