calculatesum.h
来自「国内著名嵌入式培训机构内部资料,内含一些实例代码,包括技术专题书籍」· C头文件 代码 · 共 77 行
H
77 行
/*
============================================================================
Name : CalculateSum.h
Author : hou maoqing
Version : 1.0
Copyright : Copyright (c) Hou maoqing 2008
Description : CCalculateSum declaration
============================================================================
*/
#ifndef CALCULATESUM_H
#define CALCULATESUM_H
#include <e32base.h> // For CActive, link against: euser.lib
#include <e32std.h> // For RTimer, link against: euser.lib
class CCalculateSum : public CActive
{
public:
// Cancel and destroy
~CCalculateSum();
// Two-phased constructor.
static CCalculateSum* NewL();
// Two-phased constructor.
static CCalculateSum* NewLC();
public:
// New functions
// Function for making the initial request
void StartL(TTimeIntervalMicroSeconds32 aDelay);
void StartCalculate();
private:
void CalculateNext();
void CalculateFinished();
private:
// C++ constructor
CCalculateSum();
// Second-phase constructor
void ConstructL();
private:
// From CActive
// Handle completion
void RunL();
// How to cancel me
void DoCancel();
// Override to handle leaves from RunL(). Default implementation causes
// the active scheduler to panic.
TInt RunError(TInt aError);
private:
enum TCalculateSumState
{
EUninitialized, // Uninitialized
EInitialized, // Initalized
EError // Error condition
};
private:
TInt iState; // State of the active object
RTimer iTimer; // Provides async timing service
TInt m_nStep; //步长,任务的粒度,以多少个数字为一组
TInt m_nLastInt; //上次计算的最后一个数字
TInt m_nSum; //所计算的数子的结果
};
#endif // CALCULATESUM_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?