]> git.stg.codes - stg.git/commitdiff
Added Splice method for resetables.
authorMaxim Mamontov <faust.madf@gmail.com>
Thu, 29 May 2014 10:20:26 +0000 (13:20 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Fri, 9 Jan 2015 19:56:01 +0000 (21:56 +0200)
include/stg/resetable.h
include/stg/tariff_conf.h

index c78d02476e5cbea97d9b80acd764a80aad8d1c61..8a6ad27c13584e04ca05c98caae867e97d18699a 100644 (file)
@@ -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<T> & rhs)
+    {
+        if (rhs.is_set)
+        {
+            value = rhs.value;
+            is_set = true;
+        }
+    }
 
 private:
     value_type value;
index 6a296230d8413e3b148d3969ffc69992fb115ae2..fc9807beb88fc13763b1f597a2b7f5e8446f247c 100644 (file)
@@ -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<int>    hDay;
     RESETABLE<int>    mDay;
     RESETABLE<int>    hNight;