]> git.stg.codes - stg.git/blobdiff - include/stg/user_stat.h
Implemented parser registry.
[stg.git] / include / stg / user_stat.h
index 84fbba78d578d5ef5670705f020c56c8039149c5..ff020dc7021195e8d3a921e3b52a72408f0fe6c8 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <ctime>
 #include <map>
 
 #include <ctime>
 #include <map>
+#include <utility>
+#include <string>
 
 #include "os_int.h"
 #include "resetable.h"
 
 #include "os_int.h"
 #include "resetable.h"
@@ -114,8 +116,10 @@ struct STAT_NODE
 struct USER_STAT
 {
     USER_STAT()
 struct USER_STAT
 {
     USER_STAT()
-        : up(),
-          down(),
+        : sessionUp(),
+          sessionDown(),
+          monthUp(),
+          monthDown(),
           cash(0),
           freeMb(0),
           lastCashAdd(0),
           cash(0),
           freeMb(0),
           lastCashAdd(0),
@@ -124,8 +128,10 @@ struct USER_STAT
           lastActivityTime(0)
     {}
 
           lastActivityTime(0)
     {}
 
-    DIR_TRAFF   up;
-    DIR_TRAFF   down;
+    DIR_TRAFF   sessionUp;
+    DIR_TRAFF   sessionDown;
+    DIR_TRAFF   monthUp;
+    DIR_TRAFF   monthDown;
     double      cash;
     double      freeMb;
     double      lastCashAdd;
     double      cash;
     double      freeMb;
     double      lastCashAdd;
@@ -136,6 +142,8 @@ struct USER_STAT
 //-----------------------------------------------------------------------------
 typedef std::map<IP_DIR_PAIR, STAT_NODE> TRAFF_STAT;
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 typedef std::map<IP_DIR_PAIR, STAT_NODE> TRAFF_STAT;
 //-----------------------------------------------------------------------------
+typedef std::pair<double, std::string> CASH_INFO;
+//-----------------------------------------------------------------------------
 struct USER_STAT_RES
 {
     USER_STAT_RES()
 struct USER_STAT_RES
 {
     USER_STAT_RES()
@@ -145,8 +153,10 @@ struct USER_STAT_RES
           lastCashAddTime(),
           passiveTime(),
           lastActivityTime(),
           lastCashAddTime(),
           passiveTime(),
           lastActivityTime(),
-          up(),
-          down()
+          sessionUp(),
+          sessionDown(),
+          monthUp(),
+          monthDown()
     {}
 
     USER_STAT_RES & operator= (const USER_STAT & us)
     {}
 
     USER_STAT_RES & operator= (const USER_STAT & us)
@@ -157,8 +167,10 @@ struct USER_STAT_RES
         lastCashAddTime  = us.lastCashAddTime;
         passiveTime      = us.passiveTime;
         lastActivityTime = us.lastActivityTime;
         lastCashAddTime  = us.lastCashAddTime;
         passiveTime      = us.passiveTime;
         lastActivityTime = us.lastActivityTime;
-        up               = us.up;
-        down             = us.down;
+        sessionUp        = us.sessionUp;
+        sessionDown      = us.sessionDown;
+        monthUp          = us.monthUp;
+        monthDown        = us.monthDown;
         return *this;
     }
     USER_STAT GetData() const
         return *this;
     }
     USER_STAT GetData() const
@@ -170,19 +182,25 @@ struct USER_STAT_RES
         us.lastCashAddTime  = lastCashAddTime.data();
         us.passiveTime      = passiveTime.data();
         us.lastActivityTime = lastActivityTime.data();
         us.lastCashAddTime  = lastCashAddTime.data();
         us.passiveTime      = passiveTime.data();
         us.lastActivityTime = lastActivityTime.data();
-        us.up               = up.GetData();
-        us.down             = down.GetData();
+        us.sessionUp        = sessionUp.GetData();
+        us.sessionDown      = sessionDown.GetData();
+        us.monthUp          = monthUp.GetData();
+        us.monthDown        = monthDown.GetData();
         return us;
     }
 
     RESETABLE<double>      cash;
         return us;
     }
 
     RESETABLE<double>      cash;
+    RESETABLE<CASH_INFO>   cashAdd;
+    RESETABLE<CASH_INFO>   cashSet;
     RESETABLE<double>      freeMb;
     RESETABLE<double>      lastCashAdd;
     RESETABLE<time_t>      lastCashAddTime;
     RESETABLE<time_t>      passiveTime;
     RESETABLE<time_t>      lastActivityTime;
     RESETABLE<double>      freeMb;
     RESETABLE<double>      lastCashAdd;
     RESETABLE<time_t>      lastCashAddTime;
     RESETABLE<time_t>      passiveTime;
     RESETABLE<time_t>      lastActivityTime;
-    DIR_TRAFF_RES          up;
-    DIR_TRAFF_RES          down;
+    DIR_TRAFF_RES          sessionUp;
+    DIR_TRAFF_RES          sessionDown;
+    DIR_TRAFF_RES          monthUp;
+    DIR_TRAFF_RES          monthDown;
 };
 //-----------------------------------------------------------------------------
 #endif
 };
 //-----------------------------------------------------------------------------
 #endif