simpleengine/engine/src/simpleengineutils.cpp
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 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:    Simple Engine utils
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "simpleengineutils.h"
       
    26 #include "simplecommon.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 //**********************************
       
    31 // TSimpleEngineUtils
       
    32 //**********************************
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // TSimpleEngineUtils::OpIdRange
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 TInt TSimpleEngineUtils::OpIdRange()
       
    39     {
       
    40     // Bit mask to create server OOM error response
       
    41     const TUint KMaxId = 0x40000000;
       
    42     const TInt KMagic2 = 50;
       
    43     TInt limitLowerValue = REINTERPRET_CAST(TInt, Dll::Tls() );
       
    44     TInt limitUpperValue = limitLowerValue + KRangeSize;
       
    45     // Check that counter does not go around
       
    46     if ( limitUpperValue & KMaxId )
       
    47         {
       
    48         // start from 50, if this ever happens
       
    49         limitLowerValue = KMagic2;
       
    50         limitUpperValue = limitLowerValue + KRangeSize;
       
    51         }
       
    52     Dll::SetTls( REINTERPRET_CAST(TAny*, limitUpperValue ) );
       
    53     return limitLowerValue;
       
    54     }
       
    55 
       
    56 //  End of File
       
    57