lowlevellibsandfws/pluginfw/Framework/frame/Interface.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-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 // This file contains the Interface Definition for the
       
    15 // CExampleInterface class.
       
    16 // 
       
    17 //
       
    18 
       
    19 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
       
    20 #pragma once
       
    21 #endif
       
    22 #ifndef _INC_INTERFACE_3A1D07A10155_INCLUDED
       
    23 #define _INC_INTERFACE_3A1D07A10155_INCLUDED
       
    24 
       
    25 #include <e32base.h>
       
    26 
       
    27 #include <ecom/ecom.h>
       
    28 
       
    29 /**
       
    30 	@internalComponent
       
    31 	@since 7.0
       
    32 	An example abstract class being representative of the
       
    33 	concrete class which the client wishes to use.
       
    34 	It acts as a base, for a real class to provide all the 
       
    35 	functionality that a client requires.  
       
    36 	It supplies instantiation & destruction by using
       
    37 	the ECom framework, and functional services
       
    38 	by using the methods of the actual class.
       
    39  */
       
    40 
       
    41 class CExampleInterface  : public CActive
       
    42 {
       
    43 public:
       
    44 	// The interface for passing initialisation parameters
       
    45 	// to the derived class constructor.
       
    46 	typedef struct _exampleInterfaceInitParams
       
    47 		{
       
    48 		TInt integer;
       
    49 		const TDesC* descriptor;
       
    50 		} TExampleInterfaceInitParams;
       
    51 
       
    52 	//The function which instantiates an object of this type 
       
    53 	//(eg NewL for a CBase derived object).
       
    54 	
       
    55 	static CExampleInterface* NewL();
       
    56 
       
    57 	//The function which instantiates an object of this type 
       
    58 	// using the MatchString as the resolver parameters.
       
    59 	//(eg NewL for a CBase derived object).
       
    60 	static CExampleInterface* NewL(const TDesC8& aMatchString);
       
    61 
       
    62 	//The function which instantiates an object of this type with the required parameters 
       
    63 	//(eg NewL for a CBase derived object).
       
    64 	
       
    65 	static CExampleInterface* NewL(TInt aIntParameterTest, const TDesC& aDesParameterTest);
       
    66 	
       
    67 	//The function which instantiates an object of this type 
       
    68 	//using ImplementationUid as a resolution parameter.
       
    69 	//(eg NewL for a CBase derived object).
       
    70 	static CExampleInterface* NewL2(const TUid aImplementationUid);
       
    71 	
       
    72 	//The function which instantiates an object of this type 
       
    73 	//(eg NewL for a CBase derived object).
       
    74 	static CExampleInterface* NewL3();
       
    75 	
       
    76 	//The function which instantiates an object of this type 
       
    77 	//(eg NewL for a CBase derived object).
       
    78 	static CExampleInterface* NewL4();
       
    79 
       
    80 	//The functions which instantiate object of this type with extended interface
       
    81 	static CExampleInterface* NewL5();
       
    82 	static CExampleInterface* NewL6();
       
    83 	static CExampleInterface* NewL7();
       
    84 	static CExampleInterface* NewL8();
       
    85 
       
    86 	//Standardised destructor.
       
    87 	virtual ~CExampleInterface();
       
    88 
       
    89 	//Request a list of all available implementations which 
       
    90 	//satisfy this given interface.
       
    91 	
       
    92 	static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray);
       
    93 	static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);
       
    94 
       
    95 
       
    96 	//Pure interface method
       
    97 	//Representative of a method provided on the interface by 
       
    98 	//the interface definer.
       
    99 	
       
   100 	virtual void DoMethodL() = 0;
       
   101 
       
   102 	//Pure interface method
       
   103 	//Representative of an asynchronous function which 
       
   104 	//an interface definer could specify.  
       
   105 	//It allows the client to call the function in the knowledge 
       
   106 	//that the object will commit suicide when the 
       
   107 	//function completes.
       
   108 	
       
   109 	virtual TInt FireAndForget() = 0;
       
   110 
       
   111 	//Pure interface method,
       
   112 	//Used to cross check the implementation returned by ECOM.
       
   113 	virtual TUid ImplId() = 0;
       
   114 public:
       
   115 	// Wrapper methods which get and release the extended interface using 
       
   116 	// the member iDtor_ID_Key
       
   117 	TAny* GetExtendedInterfaceL(const TUid& aInterfaceUid);
       
   118 	void ManuallyReleaseExtendedInterfaceL(const TUid& aInterfaceUid);
       
   119 
       
   120 protected:
       
   121 	//Default c'tor
       
   122 	inline CExampleInterface();
       
   123 
       
   124 //Attributes
       
   125 private:
       
   126 	
       
   127 	TUid iDtor_ID_Key;
       
   128 
       
   129 	// Declare the Test bed state accessor as a friend
       
   130 	friend class TExampleInterface_StateAccessor;
       
   131 
       
   132 };
       
   133 
       
   134 // Example extended interface classes
       
   135 class MExampleInterfaceExtended
       
   136 {
       
   137 public:
       
   138 	//Pure interface method
       
   139 	//Representative of a method provided on the interface by 
       
   140 	//the interface definer.
       
   141 	virtual void DoMethodExtended() = 0;
       
   142 };
       
   143 
       
   144 class MExampleInterfaceExtended2
       
   145 {
       
   146 public:
       
   147 	
       
   148 	//Pure interface method
       
   149 	//Representative of a method provided on the interface by 
       
   150 	//the interface definer.
       
   151 	virtual void DoMethodExtended2() = 0;
       
   152 };
       
   153 #include "Interface.inl"
       
   154 
       
   155 #endif /* _INC_INTERFACE_3A1D07A10155_INCLUDED */
       
   156