diff -r 000000000000 -r 5e5d6b214f4f uiservicetab/vimpstengine/src/cvimpstenginerequestmapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiservicetab/vimpstengine/src/cvimpstenginerequestmapper.cpp Tue Feb 02 10:12:18 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 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: Request mapper for VIMSTEngine +* +*/ + +// INCLUDE FILES + +#include "cvimpstenginerequestmapper.h" + +#include "cvimpstenginerequest.h" +#include "vimpstdebugtrace.h" + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::two phase constructor +// +// --------------------------------------------------------- +CVIMPSTEngineRequestMapper* CVIMPSTEngineRequestMapper:: NewL() + { + CVIMPSTEngineRequestMapper* self = CVIMPSTEngineRequestMapper::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::NewLC +// +// --------------------------------------------------------- +CVIMPSTEngineRequestMapper* CVIMPSTEngineRequestMapper::NewLC() + { + CVIMPSTEngineRequestMapper* self = new (ELeave) CVIMPSTEngineRequestMapper(); + CleanupStack::PushL( self ); + return self; + } + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::~CVIMPSTEngineRequestMapper +// +// --------------------------------------------------------- +CVIMPSTEngineRequestMapper::~CVIMPSTEngineRequestMapper() + { + iRequestArray.ResetAndDestroy(); + } + + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::CVIMPSTEngineRequestMapper +// +// --------------------------------------------------------- +CVIMPSTEngineRequestMapper::CVIMPSTEngineRequestMapper() + { + + } + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::CreateRequestL +// +// --------------------------------------------------------- +CVIMPSTEngineRequest* CVIMPSTEngineRequestMapper::CreateRequestL + (TXIMPRequestId& aRequestId, + TBool aIsWait, TXimpOperation aType) + { + CVIMPSTEngineRequest* req = CVIMPSTEngineRequest::NewL(aRequestId,aType ); + CleanupStack::PushL(req); + TInt status( iRequestArray.Append( req ) ); + User::LeaveIfError( status ); + + if(aIsWait) + { + req->StartWait(); + } + + + CleanupStack::Pop(req); + return req; + } + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::FindRequestId +// +// --------------------------------------------------------- +CVIMPSTEngineRequest* CVIMPSTEngineRequestMapper::FindRequestId(const TXIMPRequestId& aRequestId ) + { + TInt count = iRequestArray.Count() ; + TXIMPRequestId reqId ; + CVIMPSTEngineRequest *req = NULL; + for (TInt i=0; i < count; i++) + { + req = iRequestArray[i] ; + + reqId = req->GetRequestId() ; + + if( aRequestId == reqId ) + { + break ; + } + } + return req ; + } + +// --------------------------------------------------------- +// CVIMPSTEngineRequestMapper::RemoveRequestId +// +// --------------------------------------------------------- +void CVIMPSTEngineRequestMapper::RemoveRequestId(const TXIMPRequestId& aRequestId ) + { + TInt count = iRequestArray.Count() ; + for (TInt i=0; i < count; i++) + { + if( iRequestArray[i]->GetRequestId() == aRequestId) + { + delete iRequestArray[i]; + iRequestArray[i] = NULL; + iRequestArray.Remove( i ); + iRequestArray.Compress(); + break ; + } + } + } + + +// end of file