⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stats.h

📁 activate your member account after checking your files. If
💻 H
字号:
//======================================================================================//
// filename: Stats.cpp                                                                  //
//                                                                                      //
// author:   Pedro V. Sander                                                            //
//           ATI Research, Inc.                                                         //
//           3D Application Research Group                                              //
//           email: psander@ati.com                                                     //
//                                                                                      //
// Description: Simple statistics/histogram fuctions                                    //
//                                                                                      //
//======================================================================================//
//   (C) 2003 ATI Research, Inc.  All rights reserved.                                  //
//======================================================================================//

//-----------------------------------------------------------------------------
// Name: class CStats
// Desc: Gathers simple statistics
//-----------------------------------------------------------------------------
class CStats
{
protected:
   int m_iNum;             //number of values
   int m_iMaxNum;          //maximum number of values before has to reallocate
   int m_iZeroes;          //number of "zero" values
   float m_fSum;           //sum of all values
   float m_fSumSq;         //sum of all squared values
   float m_fMin;           //min value
   float m_fMax;           //max value
   float *m_pfData;        //pointer to all values
   int *m_piBin;           //pointer to all bins (used for histogram)
   bool m_bDataAvailable;  //whether m_pfData is populated  
   int m_iStdevNum;        //standard deviation last computed after this value index was inserted
   float m_fStdev;         //standard deviation
   char m_strName[64];     //name for this instance

public:
   //init/destroy
   CStats(char *strName = NULL, bool bKeepData = true);
   ~CStats();
   void Reset(bool bKeepData = true);

   //add a value
   void Add(float f);

   //render histogram of values
   void RenderHistogram(LPDIRECT3DDEVICE9 pd3dDevice, CD3DFont *font, float x, float y, float w, float h, int sw, int sh);

   //output stats info to text file
   void OutputInfo(FILE *fp);

   //load/save stat info binary file
   void Load(FILE *fp);
   void Save(FILE *fp);

   //get statistics
   float GetAvg();
   float GetMax();
   float GetRms();
   float GetMin();
   float GetStdev();
   int GetNum();
};

⌨️ 快捷键说明

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