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