os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServOperationQueue.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogServ/inc/LogServOperationQueue.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,81 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __LOGSERVOPERATIONQUEUE_H__
    1.20 +#define __LOGSERVOPERATIONQUEUE_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include "LogServDefs.h"
    1.24 +#include "LogServShared.h"
    1.25 +#include "LogServOperationManager.h"
    1.26 +
    1.27 +// Classes referenced
    1.28 +class MLogServTaskInterface;
    1.29 +class CLogServOperationBase;
    1.30 +
    1.31 +/**
    1.32 +Implements the MLogServOperationManager interface.
    1.33 +The class maintains two queues of operations:
    1.34 +    - "pending operations" queue. All pending operations are kept in here for execution;
    1.35 +    - "completed operations" queue. If particular operation returns results for the client, that
    1.36 +                operation will be moved to here after the execution;
    1.37 +CLogServOperationQueue implements MLogServOperationManager and dereives from CActive.
    1.38 +Every time when a new operation is added to the queue, CLogServOperationQueue object completes itsef
    1.39 +and schedules itself for an execution. When the active scheduler calls the RunL() method of the class,
    1.40 +an operation will be picked up from the pending queue and started.                
    1.41 +
    1.42 +@see MLogServOperationManager
    1.43 +@see MLogServTaskInterface
    1.44 +@see CLogServOperationBase
    1.45 + 
    1.46 +@internalComponent
    1.47 +*/
    1.48 +class CLogServOperationQueue : public CActive, public MLogServOperationManager
    1.49 +	{
    1.50 +public:
    1.51 +	static CLogServOperationQueue* NewL(MLogServTaskInterface& aTaskInterface, TInt aPriority);
    1.52 +	~CLogServOperationQueue();
    1.53 +
    1.54 +private:
    1.55 +	CLogServOperationQueue(MLogServTaskInterface& aTaskInterface, TInt aPriority);
    1.56 +
    1.57 +private: // From MLogServOperationManager
    1.58 +	void OMOperationQueueAdd(CLogServOperationBase& aOperation);
    1.59 +	void OMOperationQueueRemove(CLogServOperationBase& aOperation);
    1.60 +	void OMGetResultL(TLogOperationId aId, TLogServSessionId aSessionId, const RMessage2& aMessageToWriteTo);
    1.61 +	void OMCancel(TLogOperationId aId, TLogServSessionId aSessionId, TBool aCompleteRequest);
    1.62 +	void OMCancel(TLogServSessionId aSessionId, TBool aCompleteRequest);
    1.63 +
    1.64 +private: // From CActive
    1.65 +	void RunL();
    1.66 +	void DoCancel();
    1.67 +	TInt RunError(TInt aError);
    1.68 +
    1.69 +private: // Internal methods
    1.70 +	void CompleteRequest(TInt aCompletionCode = KErrNone);
    1.71 +	void StartNextOpL();		
    1.72 +	void DeleteFromQueue(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
    1.73 +	TBool QueueContainsOperation(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
    1.74 +	CLogServOperationBase* FindOperation(TSglQue<CLogServOperationBase>& aQueue, TLogOperationId aOperationId, TLogServSessionId aSessionId);
    1.75 +
    1.76 +private: // Member data
    1.77 +
    1.78 +	MLogServTaskInterface& iTaskInterface;
    1.79 +	CLogServOperationBase* iCurrentOperation;
    1.80 +	TSglQue<CLogServOperationBase> iQueuePending;
    1.81 +	TSglQue<CLogServOperationBase> iQueueCompleted;
    1.82 +	};
    1.83 +
    1.84 +#endif