epoc32/include/mmf/server/mmfhwdevice.inl
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.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 // modification to pass by reference would cause a BC break
    31 // coverity[pass_by_value]
    32 inline CMMFHwDevice* CMMFHwDevice::NewL(TFileName dll)
    33 	{
    34 	RLibrary library;
    35 	User::LeaveIfError(library.Load(dll));
    36 	TLibraryFunction entry=library.Lookup(2); // 1 ponits to implementation table
    37 	CMMFHwDevice* mmfHwDevice = (CMMFHwDevice*)entry();
    38 	return mmfHwDevice;
    39 	}
    40 
    41 /**
    42  *
    43  * Destructor
    44  *
    45  */
    46 
    47 CMMFHwDevice::~CMMFHwDevice()
    48 	{
    49 	// Destroy any instance variables and then
    50 	// inform ecom that this specific
    51 	// instance of the interface has been destroyed.
    52 	REComSession::DestroyedImplementation(iDtor_ID_Key);
    53 	}
    54 
    55 /**
    56  *
    57  *	Create a CMMFHwDevice object with a known implementation Uid.
    58  *  Will leave if it is not found (KErrNotFound).
    59  *
    60  *	@param aUid   -  The Uid of a plugin implementation
    61  *
    62  *	@return An instantiated CMMFHwDevice derived object from ECom.
    63  *
    64  */
    65 inline CMMFHwDevice* CMMFHwDevice::NewL(TUid aUid)
    66 	{
    67 	CMMFHwDevice* device = REINTERPRET_CAST(CMMFHwDevice*,
    68 											REComSession::CreateImplementationL(aUid, _FOFF(CMMFHwDevice,iDtor_ID_Key)));
    69 	return device;
    70 	}
    71 
    72 #endif