lowlevellibsandfws/pluginfw/Framework/frame/UnloadPolicy.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 definition of the CUnloadPolicy class.
       
    15 // 
       
    16 //
       
    17 
       
    18 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
       
    19 #pragma once
       
    20 #endif
       
    21 #ifndef _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED
       
    22 #define _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include <e32uid.h>
       
    27 #include <ecom/extendedinterfaceimplementationproxy.h>
       
    28 #include "EComEntry.h"
       
    29 
       
    30 /** 
       
    31 Type of the function pointer which is the proxy into the interface implementation collection 
       
    32 @internalComponent
       
    33 */
       
    34 typedef TImplementationProxy* (*TInstantiationL)(TInt&);
       
    35 
       
    36 /** 
       
    37 Type of the function pointer which is the proxy into the interface implementation collection 3
       
    38 @internalComponent
       
    39 */
       
    40 typedef TImplementationProxy3* (*TInstantiation3L)(TInt&);
       
    41 /**
       
    42 @enum TUnloadPolicyStatus
       
    43 @since 7.0
       
    44 Signifies if an UnloadPolicy can be deleted after its reference count has been decreased.
       
    45 This will be true if the reference count is zero and the policy is on the garbage list.
       
    46 @internalComponent
       
    47 */
       
    48 enum TUnloadPolicyStatus {EDeleteMe, EDontDeleteMe};
       
    49 
       
    50 /**
       
    51 	@internalComponent
       
    52 	@since 7.0
       
    53 	Controls the unloading of implementation groupings
       
    54  */
       
    55 
       
    56 NONSHARABLE_CLASS(CUnloadPolicy) : public CBase
       
    57 {
       
    58 public:
       
    59 /**
       
    60 	@fn				NewLC(const TEntry& aDllEntry)
       
    61 	Intended Usage	: Standardized safe construction which leaves the object on the cleanup stack.
       
    62 	Error Condition	: Cannot fully construct because of memory limitations.
       
    63 	@leave  		KErrNoMemory
       
    64 	@since			7.0
       
    65 	@param			aDllEntry Information on the dll which this policy refers to
       
    66 	@return			A pointer to the new class
       
    67 	@post			CUnloadPolicy is fully constructed and initialized.
       
    68  */
       
    69 	
       
    70 	static CUnloadPolicy* NewLC(const TEntry& aDllEntry);
       
    71 
       
    72 /**
       
    73 	@fn				~CUnloadPolicy()
       
    74 	Intended Usage	: Standard default d'tor
       
    75 	Error Condition	: None
       
    76 	@since			7.0
       
    77  */
       
    78 	
       
    79 	~CUnloadPolicy();
       
    80 
       
    81 /**
       
    82 	@fn				DecreaseReference()
       
    83 	Intended Usage	: Decrease the reference count for the specified grouping and therefore 
       
    84 					check whether it should be unloaded.
       
    85 	Error Condition	: None.
       
    86 	@since			7.0
       
    87 	@return			EDeleteMe if this unload policy can be deleted because its reference 
       
    88 					count is zero and it is on the garbage list.
       
    89 	@pre			This object is fully constructed and initialized
       
    90 	@post			If the decreased reference count has reached zero  and the policy is not
       
    91 					on the garbage list then the timer is activated.
       
    92  */
       
    93 	
       
    94 	TUnloadPolicyStatus DecreaseReference();
       
    95 
       
    96 /**
       
    97 	@fn				IncreaseReference()
       
    98 	Intended Usage	: Increase the reference count for the specified grouping.
       
    99 	Error Condition	: None.
       
   100 	@since			7.0
       
   101 	@pre			This object is fully constructed and initialized
       
   102 	@post			The reference count has been increased and if there was an outstanding timer 
       
   103 					request it has been cancelled.
       
   104  */
       
   105 	
       
   106 	void IncreaseReference();
       
   107 
       
   108 /**
       
   109 	@fn				ReferenceCount() const
       
   110 	Intended Usage	: Returns the current reference count for this grouping
       
   111 	Error Condition	: None.
       
   112 	@since			7.0
       
   113 	@return			The current library reference count for this unload policy
       
   114 	@pre			This object is fully constructed and initialized
       
   115  */
       
   116 	
       
   117 	TInt ReferenceCount() const;
       
   118 
       
   119 /**
       
   120 	@fn				DllEntryInformation() const
       
   121 	Intended Usage	: Returns information on the dll which this unload policy refers to.
       
   122 	Error Condition	: None.
       
   123 	@since			7.0
       
   124 	@pre			This object is fully constructed and initialized
       
   125  */
       
   126 	
       
   127 	const CEComEntry& DllEntryInformation() const;
       
   128 
       
   129 /**
       
   130 	@fn				LoadDllAndReturnProxyL()
       
   131 	Intended Usage	: Loads the dll which this unload policy refers to and returns a function pointer
       
   132 					to the proxy into the dll.
       
   133 	Error Condition	: Leaves with an error code.
       
   134 	@leave  		KErrInvalidDll, @see RLibrary::Load
       
   135 	@since			7.0
       
   136 	@return			The proxy function into the dll to which this unload policy refers.
       
   137 	@pre			This object is fully constructed and initialized
       
   138 	@post			iLibrary is unloaded
       
   139  */
       
   140 	
       
   141 	TLibraryFunction LoadDllAndReturnProxyL();
       
   142 
       
   143 private:
       
   144 /**
       
   145 	@internalComponent
       
   146 	@fn				CUnloadPolicy()
       
   147 	Intended Usage	: Standardized default c'tor
       
   148 	Error Condition	: None
       
   149 	@since			7.0
       
   150 	@post			CUnloadPolicy is fully constructed
       
   151  */
       
   152 	
       
   153 	CUnloadPolicy();
       
   154 
       
   155 /**
       
   156 	@fn				ConstructL(const TEntry& aDllEntry)
       
   157 	Intended Usage	: Standardized 2nd, (Initialization) phase of two phase construction.
       
   158 	Error Condition	: None
       
   159 	@leave  		None
       
   160 	@since			7.0
       
   161 	@param			aDllEntry Information on the dll to which this unload policy refers
       
   162 	@pre 			CUnloadPolicy is fully constructed.
       
   163 	@post			CUnloadPolicy is fully initialized.
       
   164  */
       
   165 	
       
   166 	void ConstructL(const TEntry& aDllEntry);
       
   167 	
       
   168 //Attributes
       
   169 private:
       
   170 	/** The controlled implementation grouping */
       
   171 	
       
   172 	RLibrary iLibrary;
       
   173 	/** Information on the Dll which this is the unload policy for */
       
   174 	
       
   175 	const CEComEntry* iDllEntry;
       
   176 	/** 
       
   177 		A reference count indicating that an implementation from
       
   178 		this implementation grouping has been instantiated / removed
       
   179 	*/	
       
   180 	TInt iReferencesInUseCount;
       
   181 };
       
   182 
       
   183 #endif /* _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED */
       
   184