remotestoragefw/remotefileengine/src/rsfwrequestallocator.cpp
branchRCL_3
changeset 19 88ee4cf65e19
parent 16 87c71b25c937
child 20 1aa8c82cb4cb
equal deleted inserted replaced
16:87c71b25c937 19:88ee4cf65e19
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Operation and request allocation and deletion
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "rsfwrequestallocator.h"
       
    20 #include "rsfwrfesyncoperation.h"
       
    21 #include "rsfwrfeasyncoperation.h"
       
    22 #include "rsfwrfemessagerequest.h"
       
    23 #include "mdebug.h"
       
    24 
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // RsfwRequestAllocator::GetSyncOperation
       
    28 // ----------------------------------------------------------------------------
       
    29 // 
       
    30 CRsfwRfeSyncOperation* RsfwRequestAllocator::GetSyncOperation(CRsfwRfeRequest* aRequest,
       
    31                                                       TInt aCaller) 
       
    32     {
       
    33     CRsfwRfeSyncOperation* pO = NULL;
       
    34     pO = new CRsfwRfeSyncOperation();
       
    35     if (pO)
       
    36         {
       
    37         pO->Set(aRequest, aCaller);
       
    38         }
       
    39     return pO;
       
    40     }
       
    41 
       
    42 // ----------------------------------------------------------------------------
       
    43 // RsfwRequestAllocator::GetAsyncOperation
       
    44 // ----------------------------------------------------------------------------
       
    45 // 
       
    46 CRsfwRfeAsyncOperation* RsfwRequestAllocator::GetAsyncOperation(CRsfwRfeRequest* aRequest,
       
    47                                                         TInt aCaller) 
       
    48     {
       
    49     CRsfwRfeAsyncOperation* pO = NULL;
       
    50     pO = new CRsfwRfeAsyncOperation();
       
    51     if (pO) 
       
    52         {
       
    53         TRAPD(err, pO->SetL(aRequest, aCaller));
       
    54         if (err) 
       
    55             {
       
    56         	DEBUGSTRING(("Setting the operation failed with error %d!!!",err));
       
    57             delete pO;
       
    58             pO = NULL;
       
    59             }
       
    60         }
       
    61     return pO;
       
    62     }
       
    63 
       
    64 // ----------------------------------------------------------------------------
       
    65 // RsfwRequestAllocator::GetMessageRequest
       
    66 // allocate requests
       
    67 // Return a pointer to a message request of type specificied by aCaller and initialised
       
    68 // ----------------------------------------------------------------------------
       
    69 // 
       
    70 CRsfwRfeMessageRequest* RsfwRequestAllocator::GetMessageRequest(
       
    71     const RMessage2& aMessage,
       
    72     CRsfwRfeSession* aSession)
       
    73     {
       
    74     CRsfwRfeMessageRequest* pM = NULL;
       
    75     
       
    76     pM = new CRsfwRfeMessageRequest();
       
    77         
       
    78     if (pM)
       
    79         {
       
    80         TRAPD(err, pM->SetL(aMessage,aSession));
       
    81         if (err)
       
    82         {
       
    83         	delete pM;
       
    84         	pM = NULL;
       
    85         }
       
    86         return pM;
       
    87         }
       
    88     else 
       
    89         {
       
    90         return NULL;
       
    91         }
       
    92     }
       
    93    
       
    94 // ----------------------------------------------------------------------------
       
    95 // RsfwRequestAllocator::FreeRequest
       
    96 // ----------------------------------------------------------------------------
       
    97 //     
       
    98 void RsfwRequestAllocator::FreeRequest(CRsfwRfeRequest* aRequest)
       
    99     {
       
   100     delete aRequest;
       
   101     }
       
   102 
       
   103