]> git.stg.codes - stg.git/blobdiff - include/stg/user_traff.h
Use single simple parser for one-tag answers.
[stg.git] / include / stg / user_traff.h
index fdefee0fe26b7f54e7ca885884a65da1a33f433b..aee1171c9b387d876bd321fd6b0d6a5985205d43 100644 (file)
@@ -30,7 +30,7 @@
 #include <iostream>
 #include <vector>
 
-#include "stg_const.h"
+#include "const.h"
 #include "os_int.h"
 
 enum TRAFF_DIRECTION {TRAFF_UPLOAD, TRAFF_DOWNLOAD};
@@ -40,17 +40,20 @@ class DIR_TRAFF
     friend std::ostream & operator<< (std::ostream & o, const DIR_TRAFF & traff);
 
 public:
+    typedef std::vector<uint64_t> ContainerType;
+    typedef ContainerType::size_type IndexType;
+
     //-------------------------------------------------------------------------
     DIR_TRAFF();
     DIR_TRAFF(const DIR_TRAFF & ts);
     DIR_TRAFF & operator=(const DIR_TRAFF & ts);
     ~DIR_TRAFF();
-    uint64_t operator[](int idx) const;
-    uint64_t & operator[](int idx);
+    uint64_t operator[](IndexType idx) const;
+    uint64_t & operator[](IndexType idx);
     DIR_TRAFF operator+(const DIR_TRAFF & ts);
 
 private:
-    std::vector<uint64_t> traff;
+    ContainerType traff;
 };
 //-----------------------------------------------------------------------------
 
@@ -73,31 +76,31 @@ inline DIR_TRAFF & DIR_TRAFF::operator=(const DIR_TRAFF & ts)
 {
 traff = ts.traff;
 return *this;
-};
+}
 //-----------------------------------------------------------------------------
-inline uint64_t & DIR_TRAFF::operator[](int idx)
+inline uint64_t & DIR_TRAFF::operator[](IndexType idx)
 {
 return traff[idx];
-};
+}
 //-----------------------------------------------------------------------------
-inline uint64_t DIR_TRAFF::operator[](int idx) const
+inline uint64_t DIR_TRAFF::operator[](IndexType idx) const
 {
 return traff[idx];
-};
+}
 //-----------------------------------------------------------------------------
 inline DIR_TRAFF DIR_TRAFF::operator+(const DIR_TRAFF & ts)
 {
-for (int i = 0; i < DIR_NUM; i++)
+for (IndexType i = 0; i < DIR_NUM; i++)
     {
     traff[i] = traff[i] + ts.traff[i];
     }
 return *this;
-};
+}
 //-----------------------------------------------------------------------------
 inline std::ostream & operator<<(std::ostream & o, const DIR_TRAFF & traff)
 {
 bool first = true;
-for (size_t i = 0; i < DIR_NUM; ++i)
+for (DIR_TRAFF::IndexType i = 0; i < DIR_NUM; ++i)
     {
     if (first)
         first = false;