]> git.stg.codes - stg.git/blobdiff - include/stg/tariff_conf.h
Lots of stylistic fixes.
[stg.git] / include / stg / tariff_conf.h
index b554e14ac63f761c8c35f192653114fda156bf8e..fc9807beb88fc13763b1f597a2b7f5e8446f247c 100644 (file)
 #ifndef TARIFF_CONF_H
 #define TARIFF_CONF_H
 
-#include <string>
-#include <vector>
-
+#include "tariff.h"
 #include "resetable.h"
 #include "const.h"
 
+#include <string>
+#include <vector>
+
 //-----------------------------------------------------------------------------
 enum
 {
@@ -120,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;
@@ -135,18 +151,20 @@ struct DIRPRICE_DATA_RES
 //-----------------------------------------------------------------------------
 struct TARIFF_CONF
 {
-    double      fee;
-    double      free;
-    int         traffType;
-    double      passiveCost;
-    std::string name;
+    double         fee;
+    double         free;
+    int            traffType;
+    double         passiveCost;
+    std::string    name;
+    TARIFF::PERIOD period;
 
     TARIFF_CONF()
         : fee(0),
           free(0),
           traffType(TRAFF_UP_DOWN),
           passiveCost(0),
-          name()
+          name(),
+          period(TARIFF::MONTH)
         {}
 
     TARIFF_CONF(const std::string & n)
@@ -154,7 +172,8 @@ struct TARIFF_CONF
           free(0),
           traffType(TRAFF_UP_DOWN),
           passiveCost(0),
-          name(n)
+          name(n),
+          period(TARIFF::MONTH)
         {}
 };
 //-----------------------------------------------------------------------------
@@ -165,7 +184,8 @@ struct TARIFF_CONF_RES
           free(),
           traffType(),
           passiveCost(),
-          name()
+          name(),
+          period()
         {}
 
     TARIFF_CONF_RES & operator=(const TARIFF_CONF & tc)
@@ -175,6 +195,7 @@ struct TARIFF_CONF_RES
         traffType   = tc.traffType;
         passiveCost = tc.passiveCost;
         name        = tc.name;
+        period      = tc.period;
         return *this;
         }
 
@@ -186,14 +207,16 @@ struct TARIFF_CONF_RES
         tc.name        = name.data();
         tc.passiveCost = passiveCost.data();
         tc.traffType   = traffType.data();
+        tc.period      = period.data();
         return tc;
         }
 
-    RESETABLE<double>      fee;
-    RESETABLE<double>      free;
-    RESETABLE<int>         traffType;
-    RESETABLE<double>      passiveCost;
-    RESETABLE<std::string> name;
+    RESETABLE<double>         fee;
+    RESETABLE<double>         free;
+    RESETABLE<int>            traffType;
+    RESETABLE<double>         passiveCost;
+    RESETABLE<std::string>    name;
+    RESETABLE<TARIFF::PERIOD> period;
 };
 //-----------------------------------------------------------------------------
 struct TARIFF_DATA