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

📄 calculatesum.h

📁 国内著名嵌入式培训机构内部资料,内含一些实例代码,包括技术专题书籍
💻 H
字号:
/*
 ============================================================================
 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -