sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __LOGSERVOPERATIONQUEUE_H__
|
sl@0
|
17 |
#define __LOGSERVOPERATIONQUEUE_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32base.h>
|
sl@0
|
20 |
#include "LogServDefs.h"
|
sl@0
|
21 |
#include "LogServShared.h"
|
sl@0
|
22 |
#include "LogServOperationManager.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
// Classes referenced
|
sl@0
|
25 |
class MLogServTaskInterface;
|
sl@0
|
26 |
class CLogServOperationBase;
|
sl@0
|
27 |
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
Implements the MLogServOperationManager interface.
|
sl@0
|
30 |
The class maintains two queues of operations:
|
sl@0
|
31 |
- "pending operations" queue. All pending operations are kept in here for execution;
|
sl@0
|
32 |
- "completed operations" queue. If particular operation returns results for the client, that
|
sl@0
|
33 |
operation will be moved to here after the execution;
|
sl@0
|
34 |
CLogServOperationQueue implements MLogServOperationManager and dereives from CActive.
|
sl@0
|
35 |
Every time when a new operation is added to the queue, CLogServOperationQueue object completes itsef
|
sl@0
|
36 |
and schedules itself for an execution. When the active scheduler calls the RunL() method of the class,
|
sl@0
|
37 |
an operation will be picked up from the pending queue and started.
|
sl@0
|
38 |
|
sl@0
|
39 |
@see MLogServOperationManager
|
sl@0
|
40 |
@see MLogServTaskInterface
|
sl@0
|
41 |
@see CLogServOperationBase
|
sl@0
|
42 |
|
sl@0
|
43 |
@internalComponent
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
class CLogServOperationQueue : public CActive, public MLogServOperationManager
|
sl@0
|
46 |
{
|
sl@0
|
47 |
public:
|
sl@0
|
48 |
static CLogServOperationQueue* NewL(MLogServTaskInterface& aTaskInterface, TInt aPriority);
|
sl@0
|
49 |
~CLogServOperationQueue();
|
sl@0
|
50 |
|
sl@0
|
51 |
private:
|
sl@0
|
52 |
CLogServOperationQueue(MLogServTaskInterface& aTaskInterface, TInt aPriority);
|
sl@0
|
53 |
|
sl@0
|
54 |
private: // From MLogServOperationManager
|
sl@0
|
55 |
void OMOperationQueueAdd(CLogServOperationBase& aOperation);
|
sl@0
|
56 |
void OMOperationQueueRemove(CLogServOperationBase& aOperation);
|
sl@0
|
57 |
void OMGetResultL(TLogOperationId aId, TLogServSessionId aSessionId, const RMessage2& aMessageToWriteTo);
|
sl@0
|
58 |
void OMCancel(TLogOperationId aId, TLogServSessionId aSessionId, TBool aCompleteRequest);
|
sl@0
|
59 |
void OMCancel(TLogServSessionId aSessionId, TBool aCompleteRequest);
|
sl@0
|
60 |
|
sl@0
|
61 |
private: // From CActive
|
sl@0
|
62 |
void RunL();
|
sl@0
|
63 |
void DoCancel();
|
sl@0
|
64 |
TInt RunError(TInt aError);
|
sl@0
|
65 |
|
sl@0
|
66 |
private: // Internal methods
|
sl@0
|
67 |
void CompleteRequest(TInt aCompletionCode = KErrNone);
|
sl@0
|
68 |
void StartNextOpL();
|
sl@0
|
69 |
void DeleteFromQueue(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
|
sl@0
|
70 |
TBool QueueContainsOperation(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
|
sl@0
|
71 |
CLogServOperationBase* FindOperation(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
|
sl@0
|
72 |
|
sl@0
|
73 |
private: // Member data
|
sl@0
|
74 |
|
sl@0
|
75 |
MLogServTaskInterface& iTaskInterface;
|
sl@0
|
76 |
CLogServOperationBase* iCurrentOperation;
|
sl@0
|
77 |
TSglQue<CLogServOperationBase> iQueuePending;
|
sl@0
|
78 |
TSglQue<CLogServOperationBase> iQueueCompleted;
|
sl@0
|
79 |
};
|
sl@0
|
80 |
|
sl@0
|
81 |
#endif
|