diff -r 000000000000 -r bde4ae8d615e os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServOperationQueue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServOperationQueue.h Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __LOGSERVOPERATIONQUEUE_H__ +#define __LOGSERVOPERATIONQUEUE_H__ + +#include +#include "LogServDefs.h" +#include "LogServShared.h" +#include "LogServOperationManager.h" + +// Classes referenced +class MLogServTaskInterface; +class CLogServOperationBase; + +/** +Implements the MLogServOperationManager interface. +The class maintains two queues of operations: + - "pending operations" queue. All pending operations are kept in here for execution; + - "completed operations" queue. If particular operation returns results for the client, that + operation will be moved to here after the execution; +CLogServOperationQueue implements MLogServOperationManager and dereives from CActive. +Every time when a new operation is added to the queue, CLogServOperationQueue object completes itsef +and schedules itself for an execution. When the active scheduler calls the RunL() method of the class, +an operation will be picked up from the pending queue and started. + +@see MLogServOperationManager +@see MLogServTaskInterface +@see CLogServOperationBase + +@internalComponent +*/ +class CLogServOperationQueue : public CActive, public MLogServOperationManager + { +public: + static CLogServOperationQueue* NewL(MLogServTaskInterface& aTaskInterface, TInt aPriority); + ~CLogServOperationQueue(); + +private: + CLogServOperationQueue(MLogServTaskInterface& aTaskInterface, TInt aPriority); + +private: // From MLogServOperationManager + void OMOperationQueueAdd(CLogServOperationBase& aOperation); + void OMOperationQueueRemove(CLogServOperationBase& aOperation); + void OMGetResultL(TLogOperationId aId, TLogServSessionId aSessionId, const RMessage2& aMessageToWriteTo); + void OMCancel(TLogOperationId aId, TLogServSessionId aSessionId, TBool aCompleteRequest); + void OMCancel(TLogServSessionId aSessionId, TBool aCompleteRequest); + +private: // From CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: // Internal methods + void CompleteRequest(TInt aCompletionCode = KErrNone); + void StartNextOpL(); + void DeleteFromQueue(TSglQue& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId); + TBool QueueContainsOperation(TSglQue& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId); + CLogServOperationBase* FindOperation(TSglQue& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId); + +private: // Member data + + MLogServTaskInterface& iTaskInterface; + CLogServOperationBase* iCurrentOperation; + TSglQue iQueuePending; + TSglQue iQueueCompleted; + }; + +#endif