sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This file contains the definition of the CUnloadPolicy class. sl@0: // sl@0: // sl@0: sl@0: #if defined (_MSC_VER) && (_MSC_VER >= 1000) sl@0: #pragma once sl@0: #endif sl@0: #ifndef _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED sl@0: #define _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "EComEntry.h" sl@0: sl@0: /** sl@0: Type of the function pointer which is the proxy into the interface implementation collection sl@0: @internalComponent sl@0: */ sl@0: typedef TImplementationProxy* (*TInstantiationL)(TInt&); sl@0: sl@0: /** sl@0: Type of the function pointer which is the proxy into the interface implementation collection 3 sl@0: @internalComponent sl@0: */ sl@0: typedef TImplementationProxy3* (*TInstantiation3L)(TInt&); sl@0: /** sl@0: @enum TUnloadPolicyStatus sl@0: @since 7.0 sl@0: Signifies if an UnloadPolicy can be deleted after its reference count has been decreased. sl@0: This will be true if the reference count is zero and the policy is on the garbage list. sl@0: @internalComponent sl@0: */ sl@0: enum TUnloadPolicyStatus {EDeleteMe, EDontDeleteMe}; sl@0: sl@0: /** sl@0: @internalComponent sl@0: @since 7.0 sl@0: Controls the unloading of implementation groupings sl@0: */ sl@0: sl@0: NONSHARABLE_CLASS(CUnloadPolicy) : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: @fn NewLC(const TEntry& aDllEntry) sl@0: Intended Usage : Standardized safe construction which leaves the object on the cleanup stack. sl@0: Error Condition : Cannot fully construct because of memory limitations. sl@0: @leave KErrNoMemory sl@0: @since 7.0 sl@0: @param aDllEntry Information on the dll which this policy refers to sl@0: @return A pointer to the new class sl@0: @post CUnloadPolicy is fully constructed and initialized. sl@0: */ sl@0: sl@0: static CUnloadPolicy* NewLC(const TEntry& aDllEntry); sl@0: sl@0: /** sl@0: @fn ~CUnloadPolicy() sl@0: Intended Usage : Standard default d'tor sl@0: Error Condition : None sl@0: @since 7.0 sl@0: */ sl@0: sl@0: ~CUnloadPolicy(); sl@0: sl@0: /** sl@0: @fn DecreaseReference() sl@0: Intended Usage : Decrease the reference count for the specified grouping and therefore sl@0: check whether it should be unloaded. sl@0: Error Condition : None. sl@0: @since 7.0 sl@0: @return EDeleteMe if this unload policy can be deleted because its reference sl@0: count is zero and it is on the garbage list. sl@0: @pre This object is fully constructed and initialized sl@0: @post If the decreased reference count has reached zero and the policy is not sl@0: on the garbage list then the timer is activated. sl@0: */ sl@0: sl@0: TUnloadPolicyStatus DecreaseReference(); sl@0: sl@0: /** sl@0: @fn IncreaseReference() sl@0: Intended Usage : Increase the reference count for the specified grouping. sl@0: Error Condition : None. sl@0: @since 7.0 sl@0: @pre This object is fully constructed and initialized sl@0: @post The reference count has been increased and if there was an outstanding timer sl@0: request it has been cancelled. sl@0: */ sl@0: sl@0: void IncreaseReference(); sl@0: sl@0: /** sl@0: @fn ReferenceCount() const sl@0: Intended Usage : Returns the current reference count for this grouping sl@0: Error Condition : None. sl@0: @since 7.0 sl@0: @return The current library reference count for this unload policy sl@0: @pre This object is fully constructed and initialized sl@0: */ sl@0: sl@0: TInt ReferenceCount() const; sl@0: sl@0: /** sl@0: @fn DllEntryInformation() const sl@0: Intended Usage : Returns information on the dll which this unload policy refers to. sl@0: Error Condition : None. sl@0: @since 7.0 sl@0: @pre This object is fully constructed and initialized sl@0: */ sl@0: sl@0: const CEComEntry& DllEntryInformation() const; sl@0: sl@0: /** sl@0: @fn LoadDllAndReturnProxyL() sl@0: Intended Usage : Loads the dll which this unload policy refers to and returns a function pointer sl@0: to the proxy into the dll. sl@0: Error Condition : Leaves with an error code. sl@0: @leave KErrInvalidDll, @see RLibrary::Load sl@0: @since 7.0 sl@0: @return The proxy function into the dll to which this unload policy refers. sl@0: @pre This object is fully constructed and initialized sl@0: @post iLibrary is unloaded sl@0: */ sl@0: sl@0: TLibraryFunction LoadDllAndReturnProxyL(); sl@0: sl@0: private: sl@0: /** sl@0: @internalComponent sl@0: @fn CUnloadPolicy() sl@0: Intended Usage : Standardized default c'tor sl@0: Error Condition : None sl@0: @since 7.0 sl@0: @post CUnloadPolicy is fully constructed sl@0: */ sl@0: sl@0: CUnloadPolicy(); sl@0: sl@0: /** sl@0: @fn ConstructL(const TEntry& aDllEntry) sl@0: Intended Usage : Standardized 2nd, (Initialization) phase of two phase construction. sl@0: Error Condition : None sl@0: @leave None sl@0: @since 7.0 sl@0: @param aDllEntry Information on the dll to which this unload policy refers sl@0: @pre CUnloadPolicy is fully constructed. sl@0: @post CUnloadPolicy is fully initialized. sl@0: */ sl@0: sl@0: void ConstructL(const TEntry& aDllEntry); sl@0: sl@0: //Attributes sl@0: private: sl@0: /** The controlled implementation grouping */ sl@0: sl@0: RLibrary iLibrary; sl@0: /** Information on the Dll which this is the unload policy for */ sl@0: sl@0: const CEComEntry* iDllEntry; sl@0: /** sl@0: A reference count indicating that an implementation from sl@0: this implementation grouping has been instantiated / removed sl@0: */ sl@0: TInt iReferencesInUseCount; sl@0: }; sl@0: sl@0: #endif /* _INC_UNLOADPOLICY_3A1D309500CE_INCLUDED */ sl@0: