29
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Request mapper for VIMSTEngine
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
|
|
20 |
#include "cvimpstenginerequestmapper.h"
|
|
21 |
|
|
22 |
#include "cvimpstenginerequest.h"
|
|
23 |
|
|
24 |
#include "uiservicetabtracer.h"
|
|
25 |
|
|
26 |
// ---------------------------------------------------------
|
|
27 |
// CVIMPSTEngineRequestMapper::two phase constructor
|
|
28 |
//
|
|
29 |
// ---------------------------------------------------------
|
|
30 |
CVIMPSTEngineRequestMapper* CVIMPSTEngineRequestMapper:: NewL()
|
|
31 |
{
|
|
32 |
CVIMPSTEngineRequestMapper* self = CVIMPSTEngineRequestMapper::NewLC();
|
|
33 |
CleanupStack::Pop( self );
|
|
34 |
return self;
|
|
35 |
}
|
|
36 |
|
|
37 |
// ---------------------------------------------------------
|
|
38 |
// CVIMPSTEngineRequestMapper::NewLC
|
|
39 |
//
|
|
40 |
// ---------------------------------------------------------
|
|
41 |
CVIMPSTEngineRequestMapper* CVIMPSTEngineRequestMapper::NewLC()
|
|
42 |
{
|
|
43 |
CVIMPSTEngineRequestMapper* self = new (ELeave) CVIMPSTEngineRequestMapper();
|
|
44 |
CleanupStack::PushL( self );
|
|
45 |
return self;
|
|
46 |
}
|
|
47 |
|
|
48 |
// ---------------------------------------------------------
|
|
49 |
// CVIMPSTEngineRequestMapper::~CVIMPSTEngineRequestMapper
|
|
50 |
//
|
|
51 |
// ---------------------------------------------------------
|
|
52 |
CVIMPSTEngineRequestMapper::~CVIMPSTEngineRequestMapper()
|
|
53 |
{
|
|
54 |
iRequestArray.ResetAndDestroy();
|
|
55 |
}
|
|
56 |
|
|
57 |
|
|
58 |
// ---------------------------------------------------------
|
|
59 |
// CVIMPSTEngineRequestMapper::CVIMPSTEngineRequestMapper
|
|
60 |
//
|
|
61 |
// ---------------------------------------------------------
|
|
62 |
CVIMPSTEngineRequestMapper::CVIMPSTEngineRequestMapper()
|
|
63 |
{
|
|
64 |
|
|
65 |
}
|
|
66 |
|
|
67 |
// ---------------------------------------------------------
|
|
68 |
// CVIMPSTEngineRequestMapper::CreateRequestL
|
|
69 |
//
|
|
70 |
// ---------------------------------------------------------
|
|
71 |
CVIMPSTEngineRequest* CVIMPSTEngineRequestMapper::CreateRequestL
|
|
72 |
(TXIMPRequestId& aRequestId,
|
|
73 |
TBool aIsWait, TXimpOperation aType)
|
|
74 |
{
|
|
75 |
TRACER_AUTO;
|
|
76 |
CVIMPSTEngineRequest* req = CVIMPSTEngineRequest::NewL(aRequestId,aType );
|
|
77 |
CleanupStack::PushL(req);
|
|
78 |
TInt status( iRequestArray.Append( req ) );
|
|
79 |
User::LeaveIfError( status );
|
|
80 |
|
|
81 |
if(aIsWait)
|
|
82 |
{
|
|
83 |
req->StartWait();
|
|
84 |
}
|
|
85 |
|
|
86 |
|
|
87 |
CleanupStack::Pop(req);
|
|
88 |
return req;
|
|
89 |
}
|
|
90 |
|
|
91 |
// ---------------------------------------------------------
|
|
92 |
// CVIMPSTEngineRequestMapper::FindRequestId
|
|
93 |
//
|
|
94 |
// ---------------------------------------------------------
|
|
95 |
CVIMPSTEngineRequest* CVIMPSTEngineRequestMapper::FindRequestId(const TXIMPRequestId& aRequestId )
|
|
96 |
{
|
|
97 |
TRACER_AUTO;
|
|
98 |
TInt count = iRequestArray.Count() ;
|
|
99 |
TXIMPRequestId reqId ;
|
|
100 |
CVIMPSTEngineRequest *req = NULL;
|
|
101 |
for (TInt i=0; i < count; i++)
|
|
102 |
{
|
|
103 |
req = iRequestArray[i] ;
|
|
104 |
|
|
105 |
reqId = req->GetRequestId() ;
|
|
106 |
|
|
107 |
if( aRequestId == reqId )
|
|
108 |
{
|
|
109 |
break ;
|
|
110 |
}
|
|
111 |
}
|
|
112 |
return req ;
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------
|
|
116 |
// CVIMPSTEngineRequestMapper::RemoveRequestId
|
|
117 |
//
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
void CVIMPSTEngineRequestMapper::RemoveRequestId(const TXIMPRequestId& aRequestId )
|
|
120 |
{
|
|
121 |
TRACER_AUTO;
|
|
122 |
TInt count = iRequestArray.Count() ;
|
|
123 |
for (TInt i=0; i < count; i++)
|
|
124 |
{
|
|
125 |
if( iRequestArray[i]->GetRequestId() == aRequestId)
|
|
126 |
{
|
|
127 |
delete iRequestArray[i];
|
|
128 |
iRequestArray[i] = NULL;
|
|
129 |
iRequestArray.Remove( i );
|
|
130 |
iRequestArray.Compress();
|
|
131 |
break ;
|
|
132 |
}
|
|
133 |
}
|
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
// end of file
|