diff -r 000000000000 -r 094583676ce7 wvuing/wvuiada/Src/CCAAdapterDll.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wvuing/wvuiada/Src/CCAAdapterDll.cpp Thu Dec 17 08:41:52 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Dll access point. +* +*/ + + + +// INCLUDES +#include "CCAAdapterDll.h" +#include "CCAImpsFactory.h" +#include + +// ================= OTHER EXPORTED FUNCTIONS ============== + + +/** +* Creates concrete interface factory if not created earlier. +* @return MCAImpsFactory abstract base class for factory. +*/ +EXPORT_C MCAImpsFactory* CreateImpsFactoryL() + { + MCAImpsFactory* mFactory = NULL; + mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() ); + if ( ! mFactory ) + { + CCAImpsFactory *cFactory = CCAImpsFactory::NewL(); + mFactory = cFactory; + CleanupStack::PushL( cFactory ); + User::LeaveIfError( Dll::SetTls( static_cast< TAny* > ( mFactory ) ) ); + CleanupStack::Pop( cFactory ); + } + return mFactory; + } + +/** +* Returns current factory instance or NULL if not created yet +* @return MCAImpsFactory current instance, can be NULL +*/ +EXPORT_C MCAImpsFactory* CurrentImpsFactoryInstance() + { + MCAImpsFactory *mFactory = NULL; + mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() ); + return mFactory; + } + +/** +* Destroys the adapter. +*/ +EXPORT_C void ReleaseAdapterL() + { + MCAImpsFactory *mFactory = NULL; + mFactory = static_cast< MCAImpsFactory* > ( Dll::Tls() ); + if ( mFactory ) + { + CCAImpsFactory *cFactory = NULL; + cFactory = static_cast< CCAImpsFactory* > ( mFactory ); + if ( cFactory ) + { + delete cFactory; + } + // Ignore error + Dll::SetTls( NULL ); + } + } + +// End of File