stats.h

来自「clique code with sample data set. clique」· C头文件 代码 · 共 39 行

H
39
字号
#ifndef __STATS_H
#define __STATS_H

#include<iostream.h>
#include<vector.h>

class iterstat{
public:
   iterstat(int nc=0, int nl=0, int nm=0, double tt=0.0, double aa=0.0):
      numcand(nc), numlarge(nl), nummax(nm), time(tt), avgtid(aa){}
   int numcand;   
   int numlarge;
   int nummax;
   double time;
   double avgtid;
};
 
class Stats: public vector<iterstat>{
public:
   static double sumtime;
   static int sumcand;
   static int sumlarge;
   static int summax;
   static int numjoin;
   static double tottime;

   //Stats();

   void add(iterstat &is);
   void add(int cand, int freq, double time, int max=0, double avgtid=0.0);
   void incrcand(unsigned int pos, int ncand=1);
   void incrlarge(unsigned int pos, int nlarge=1);
   void incrmax(unsigned int pos, int nmax=1);
   void incrtime(unsigned int pos, double ntime);
   friend ostream& operator << (ostream& fout, Stats& stats);
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?