wvuing/wvuiada/Src/CCAAdapterDll.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 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:  Dll access point.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include "CCAAdapterDll.h"
       
    22 #include "CCAImpsFactory.h"
       
    23 #include <e32std.h>
       
    24 
       
    25 // ================= OTHER EXPORTED FUNCTIONS ==============
       
    26 
       
    27 
       
    28 /**
       
    29 * Creates concrete interface factory if not created earlier.
       
    30 * @return MCAImpsFactory abstract base class for factory.
       
    31 */
       
    32 EXPORT_C MCAImpsFactory* CreateImpsFactoryL()
       
    33     {
       
    34     MCAImpsFactory* mFactory = NULL;
       
    35     mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() );
       
    36     if ( ! mFactory )
       
    37         {
       
    38         CCAImpsFactory *cFactory = CCAImpsFactory::NewL();
       
    39         mFactory = cFactory;
       
    40         CleanupStack::PushL( cFactory );
       
    41         User::LeaveIfError( Dll::SetTls( static_cast< TAny* > ( mFactory ) ) );
       
    42         CleanupStack::Pop( cFactory );
       
    43         }
       
    44     return mFactory;
       
    45     }
       
    46 
       
    47 /**
       
    48 * Returns current factory instance or NULL if not created yet
       
    49 * @return MCAImpsFactory current instance, can be NULL
       
    50 */
       
    51 EXPORT_C MCAImpsFactory* CurrentImpsFactoryInstance()
       
    52     {
       
    53     MCAImpsFactory *mFactory = NULL;
       
    54     mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() );
       
    55     return mFactory;
       
    56     }
       
    57 
       
    58 /**
       
    59 * Destroys the adapter.
       
    60 */
       
    61 EXPORT_C void ReleaseAdapterL()
       
    62     {
       
    63     MCAImpsFactory *mFactory = NULL;
       
    64     mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() );
       
    65     if ( mFactory )
       
    66         {
       
    67         CCAImpsFactory *cFactory = NULL;
       
    68         cFactory = static_cast< CCAImpsFactory* > ( mFactory );
       
    69         if ( cFactory )
       
    70             {
       
    71             delete cFactory;
       
    72             }
       
    73         // Ignore error
       
    74         Dll::SetTls( NULL );
       
    75         }
       
    76     }
       
    77 
       
    78 //  End of File