📄 integersummationidle.h
字号:
/**
*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -