wvuing/wvvariant/AlternatorSrc/AlternatorGlobals.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2003-2005 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:  Singleton implementation for alternator.dll.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  Include Files
       
    20 #include "CAlternator.h"
       
    21 #include "CAlternatorImp.h"
       
    22 #include "AlternatorGlobals.h"
       
    23 #include <e32svr.h>
       
    24 
       
    25 
       
    26 
       
    27 // Creates alternator
       
    28 EXPORT_C CAlternator* CreateAlternatorL(  const TDesC& aBrandRoot )
       
    29     {
       
    30     if ( ! Dll::Tls() )
       
    31         {
       
    32         CAlternator* alternator = CAlternatorImp::NewL( aBrandRoot );
       
    33         if ( ! alternator )
       
    34             {
       
    35             return NULL;
       
    36             }
       
    37         Dll::SetTls( alternator );
       
    38         }
       
    39     else
       
    40         {
       
    41         ( ( CAlternatorImp* )Dll::Tls() )->SetBrandRoot( aBrandRoot );
       
    42         }
       
    43 
       
    44     return ( CAlternator* )Dll::Tls();
       
    45     }
       
    46 
       
    47 // Deletes alternator
       
    48 void ReleaseAlternatorL()
       
    49     {
       
    50     if ( Dll::Tls() )
       
    51         {
       
    52         delete ( CAlternator* )Dll::Tls();
       
    53         Dll::SetTls( NULL ); // set null for mark of deletion
       
    54         }
       
    55     }
       
    56 
       
    57