uiacceltk/hitchcock/Client/src/alfbatchbuffer.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2007 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:   API to control the command batch buffer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "alf/alfbatchbuffer.h"
       
    21 #include "alf/alfenv.h"
       
    22 #include "alfclient.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // TBatchBufferData
       
    26 //
       
    27 // private member data
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 struct CAlfBatchBuffer::TBatchBufferData
       
    31     {
       
    32     TBatchBufferData() : 
       
    33         iClient(0) {}
       
    34     
       
    35     RAlfClient* iClient;
       
    36     };
       
    37 
       
    38 
       
    39 // ======== MEMBER FUNCTIONS ========
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Constructor
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CAlfBatchBuffer::CAlfBatchBuffer()
       
    46     {
       
    47     }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // 2nd phase constructor
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 void CAlfBatchBuffer::ConstructL( CAlfEnv& aEnv )
       
    55     {
       
    56     iData = new (ELeave) TBatchBufferData;
       
    57     iData->iClient = &aEnv.Client();
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // 2-phased constructor
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CAlfBatchBuffer* CAlfBatchBuffer::NewL( CAlfEnv& aEnv )
       
    66     {
       
    67     CAlfBatchBuffer* self = new( ELeave ) CAlfBatchBuffer;
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL(aEnv);
       
    70     CleanupStack::Pop( self );
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // Destructor
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 CAlfBatchBuffer::~CAlfBatchBuffer()
       
    79     {
       
    80     if ( iData )
       
    81         {
       
    82         }
       
    83     delete iData;
       
    84     iData = NULL;
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // Sets the flush mode
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 EXPORT_C void CAlfBatchBuffer::SetAutoFlushMode( TAlfAutoFlushMode aAutoFlushMode )
       
    93     {
       
    94     iData->iClient->SetAutoFlushMode( aAutoFlushMode );
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // Gets the flush mode
       
    99 // ---------------------------------------------------------------------------
       
   100 //    
       
   101 EXPORT_C TAlfAutoFlushMode CAlfBatchBuffer::AutoFlushMode() const
       
   102     {
       
   103     return iData->iClient->AutoFlushMode();
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // Manual flush
       
   108 // ---------------------------------------------------------------------------
       
   109 //    
       
   110 EXPORT_C TInt CAlfBatchBuffer::FlushBatchBuffer()
       
   111     {
       
   112     return iData->iClient->FlushBatchBuffer();
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // Set the max size
       
   117 // ---------------------------------------------------------------------------
       
   118 //    
       
   119 EXPORT_C void CAlfBatchBuffer::SetMaxBatchBufferSize( TInt aBufferSize )
       
   120     {
       
   121     iData->iClient->SetMaxBatchBufferSize( aBufferSize );
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // Get batch buffer info
       
   126 // ---------------------------------------------------------------------------
       
   127 //    
       
   128 EXPORT_C TInt CAlfBatchBuffer::GetBatchBufferInfo( 
       
   129         TAlfBatchBufferInfoType aBufferInfoType ) const
       
   130     {
       
   131     return iData->iClient->GetBatchBufferInfo( aBufferInfoType );
       
   132     }
       
   133