epoc32/include/mmf/server/mmfhwdevice.inl
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __MMF_HW_DEVICE_INL__
    17 #define __MMF_HW_DEVICE_INL__
    18 
    19 #include <ecom/ecom.h>
    20 
    21 
    22 /**
    23 Create a CMMFHwDevice object from .dll.
    24 Will leave if dll cannot be loaded (KErrNotFound).
    25 
    26 @param dll Implementation .dll
    27 
    28 @return an instantiated CMMFHwDevice derived object from a DLL.
    29 */
    30 inline CMMFHwDevice* CMMFHwDevice::NewL(TFileName dll)
    31 	{
    32 	RLibrary library;
    33 	User::LeaveIfError(library.Load(dll));
    34 	TLibraryFunction entry=library.Lookup(2); // 1 ponits to implementation table
    35 	CMMFHwDevice* mmfHwDevice = (CMMFHwDevice*)entry();
    36 	return mmfHwDevice;
    37 	}
    38 
    39 /**
    40  *
    41  * Destructor
    42  *
    43  */
    44 
    45 CMMFHwDevice::~CMMFHwDevice()
    46 	{
    47 	// Destroy any instance variables and then
    48 	// inform ecom that this specific
    49 	// instance of the interface has been destroyed.
    50 	REComSession::DestroyedImplementation(iDtor_ID_Key);
    51 	}
    52 
    53 /**
    54  *
    55  *	Create a CMMFHwDevice object with a known implementation Uid.
    56  *  Will leave if it is not found (KErrNotFound).
    57  *
    58  *	@param aUid   -  The Uid of a plugin implementation
    59  *
    60  *	@return An instantiated CMMFHwDevice derived object from ECom.
    61  *
    62  */
    63 inline CMMFHwDevice* CMMFHwDevice::NewL(TUid aUid)
    64 	{
    65 	CMMFHwDevice* device = REINTERPRET_CAST(CMMFHwDevice*,
    66 											REComSession::CreateImplementationL(aUid, _FOFF(CMMFHwDevice,iDtor_ID_Key)));
    67 	return device;
    68 	}
    69 
    70 #endif