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