integersummationidle.h

来自「基于Symbian平台下随心所欲控制屏幕的灯亮熄.在观看视频和发短信时这一点非常」· C头文件 代码 · 共 110 行

H
110
字号
/**
*
* CIntegerSummationIdle IntegerSummation.h
* This is a class to that adds the first n integers 
* It uses the CIdle class to gain processor time and complete
* a long task by breaking it into parts.
*
* Copyright (c) 2004 Nokia Corporation
* version 2.0
*/

#ifndef __INTEGERSUMMATIONIDLE_H__
#define __INTEGERSUMMATIONIDLE_H__

// INCLUDES

// System includes
#include <e32base.h>
#include "SummationObserver.h"

// CLASS DECLARATION

class CIntegerSummationIdle : public CBase
	{
public:	// Construction and destruction.
    /**
     * Function:    NewL
     *
     * Description: Creates instance of CIntegerSummationIdle object
     *
	 * Params: aObserver. Observer to be notified when summation is complete 
     */
	static CIntegerSummationIdle* NewL(MSummationObserver& aObserver);

    /**
     * Function:    ~CIntegerSummationIdle
     *
     * Description: Destroys CIntegerSummationIdle object
     */
	~CIntegerSummationIdle();

public:	// Methods.
    /**
     * Function:    StartSum
     *
     * Description: This function is called to initiate the calculation
     */
	void StartSumL();

private:	// Construction.
    /**
     * Function:    CIntegerSummationIdle
     *
     * Description: Constructor
     *
	 * Params: aObserver. Observer to be notified when summation is complete 
     */
	CIntegerSummationIdle(MSummationObserver& aObserver);

    /**
     * Function:    ConstructL
     *
     * Description: 2nd Phase Constructor
     */
	void ConstructL();


private:
    /**
     * Function:    Completed
     *
     * Description: Called when the task is complete
	 *              Notifies the observer of the result
     *
     */
	void Completed();

    /**
     * Function:    DoBackgroundSum
     *
     * Description: Implementation of one stage of the task
	 *	
     * Returns:     If whole task is complete, returns 0, a positive integer otherwise
     *
     */
	TInt DoBackgroundSum();

    /**
     * Function:    BackgroundSum
     *
     * Description: When we have been assigned some time to run this function 
	 *              will be called. It will call DoBackgroundSum() to carry out
	 *              a stage of the task.
	 *	
     * Returns:     If whole task is complete, returns 0, a positive integer otherwise
     *
     */
	static TInt BackgroundSum(TAny *aIntSumIdle);

private:	// Data.
	TInt	iTotal;
	TInt	iStage;
	MSummationObserver& iObserver;
	CIdle*	iSumMore;
	};

#endif	// __INTEGERSUMMATION_H__

// End of File

⌨️ 快捷键说明

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