author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// |
sl@0 | 15 |
|
sl@0 | 16 |
/** |
sl@0 | 17 |
@file |
sl@0 | 18 |
@test |
sl@0 | 19 |
@internalComponent - Internal Symbian test code |
sl@0 | 20 |
*/ |
sl@0 | 21 |
|
sl@0 | 22 |
#include "trequestorder.h" |
sl@0 | 23 |
|
sl@0 | 24 |
CRequestOrder::CRequestOrder(TInt aNumberAsynchronousRequests) : |
sl@0 | 25 |
iNumberAsynchronousRequests(aNumberAsynchronousRequests) |
sl@0 | 26 |
{ |
sl@0 | 27 |
} |
sl@0 | 28 |
|
sl@0 | 29 |
CRequestOrder::~CRequestOrder() |
sl@0 | 30 |
{ |
sl@0 | 31 |
delete iOrderArray; |
sl@0 | 32 |
iLock.Close(); |
sl@0 | 33 |
} |
sl@0 | 34 |
|
sl@0 | 35 |
void CRequestOrder::ConstructL() |
sl@0 | 36 |
{ |
sl@0 | 37 |
User::LeaveIfError(iLock.CreateLocal()); |
sl@0 | 38 |
|
sl@0 | 39 |
iOrderArray = new (ELeave) TOrderArray[iNumberAsynchronousRequests]; |
sl@0 | 40 |
User::LeaveIfNull(iOrderArray); |
sl@0 | 41 |
|
sl@0 | 42 |
ResetAll(); |
sl@0 | 43 |
} |
sl@0 | 44 |
|
sl@0 | 45 |
CRequestOrder* CRequestOrder::NewL(const TInt aNumberAsynchronousRequests) |
sl@0 | 46 |
{ |
sl@0 | 47 |
CRequestOrder* requestOrder = new (ELeave) CRequestOrder(aNumberAsynchronousRequests); |
sl@0 | 48 |
CleanupStack::PushL(requestOrder); |
sl@0 | 49 |
requestOrder->ConstructL(); |
sl@0 | 50 |
CleanupStack::Pop(); |
sl@0 | 51 |
return requestOrder; |
sl@0 | 52 |
} |
sl@0 | 53 |
|
sl@0 | 54 |
|
sl@0 | 55 |
void CRequestOrder::ResetAll() |
sl@0 | 56 |
{ |
sl@0 | 57 |
iIndex=0; |
sl@0 | 58 |
iOrderIndexBefore=0; |
sl@0 | 59 |
iOrderIndexComposition=0; |
sl@0 | 60 |
iOrderIndexAfter=0; |
sl@0 | 61 |
|
sl@0 | 62 |
for(TInt i=0; i<iNumberAsynchronousRequests;i++) |
sl@0 | 63 |
{ |
sl@0 | 64 |
iOrderArray[i].iType = EOrderErr; |
sl@0 | 65 |
iOrderArray[i].iNumber = 0; |
sl@0 | 66 |
} |
sl@0 | 67 |
} |
sl@0 | 68 |
|
sl@0 | 69 |
TInt CRequestOrder::GetIndex() |
sl@0 | 70 |
{ |
sl@0 | 71 |
return iIndex; |
sl@0 | 72 |
} |
sl@0 | 73 |
|
sl@0 | 74 |
void CRequestOrder::SetOrder(TOrderType aOrderType) |
sl@0 | 75 |
{ |
sl@0 | 76 |
iLock.Wait(); |
sl@0 | 77 |
iOrderArray[iIndex].iType = aOrderType; |
sl@0 | 78 |
switch (aOrderType) |
sl@0 | 79 |
{ |
sl@0 | 80 |
case EOrderBefore: |
sl@0 | 81 |
{ |
sl@0 | 82 |
iOrderArray[iIndex].iNumber = iOrderIndexBefore++; |
sl@0 | 83 |
break; |
sl@0 | 84 |
} |
sl@0 | 85 |
case EOrderComposition: |
sl@0 | 86 |
{ |
sl@0 | 87 |
iOrderArray[iIndex].iNumber = iOrderIndexComposition++; |
sl@0 | 88 |
break; |
sl@0 | 89 |
} |
sl@0 | 90 |
case EOrderAfter: |
sl@0 | 91 |
{ |
sl@0 | 92 |
iOrderArray[iIndex].iNumber = iOrderIndexAfter++; |
sl@0 | 93 |
break; |
sl@0 | 94 |
} |
sl@0 | 95 |
default: |
sl@0 | 96 |
{ |
sl@0 | 97 |
_LIT(KMsg, "GRAPHICS-SURFACEUPDATE-0003"); |
sl@0 | 98 |
User::Panic(KMsg, 1); |
sl@0 | 99 |
break; |
sl@0 | 100 |
} |
sl@0 | 101 |
} |
sl@0 | 102 |
iIndex++; |
sl@0 | 103 |
iLock.Signal(); |
sl@0 | 104 |
} |
sl@0 | 105 |
|
sl@0 | 106 |
TOrderType CRequestOrder::GetOrderType(TInt aIndex) |
sl@0 | 107 |
{ |
sl@0 | 108 |
return iOrderArray[aIndex].iType; |
sl@0 | 109 |
} |
sl@0 | 110 |
|
sl@0 | 111 |
TInt CRequestOrder::GetOrderNumber(TInt aIndex) |
sl@0 | 112 |
{ |
sl@0 | 113 |
return iOrderArray[aIndex].iNumber; |
sl@0 | 114 |
} |