integersummation.h

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

H
112
字号
/**
*
* CIntegerSummation IntegerSummation.h
* This is a class to that adds the first n integers 
* It uses the idea of Active Objects to split up what would be a long task.
*
* Copyright (c) 2004 Nokia Corporation
* version 2.0
*/

#ifndef __INTEGERSUMMATION_H__
#define __INTEGERSUMMATION_H__

// INCLUDES

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


// CLASS DECLARATION


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

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

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

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

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

private:	// From CActive.
    /**
     * Function:    RunL
     *
     * Description: Handles request completion - called by the Active Scheduler
	 *              Calls for the next stage of the task to be carried out  
     */
	void RunL();

    /**
     * Function:    DoCancel
     *
     * Description: Cancel outstanding request - called by Cancel
     */
	void DoCancel();

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

    /**
     * Function:    DoStage
     *
     * Description: Completes one step of the task and then requests
     *              more time from the Active Scheduler if processing 
	 *              is not complete.
     */
	void DoStage();
	
private:	// Data.
	TInt	iTotal;
	TInt	iStage;
	MSummationObserver& iObserver;
	};

#endif	// __INTEGERSUMMATION_H__

// End of File

⌨️ 快捷键说明

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