williamr@4: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // A revised version of the CRegisteredParserDll class. This no longer uses a williamr@4: // reference to a CParserRegistrationData object. Instead a UidType is passed in williamr@4: // the constructor, or through a set method. The class is used to find the file williamr@4: // which contains a parser, to load and maintain a reference count of the number of williamr@4: // objects using the dll, so that it can be unloaded when no longer required. williamr@4: // It will also unload the dll when a new parser is required. williamr@4: // williamr@4: // williamr@4: williamr@4: williamr@4: williamr@4: #ifndef __REGPSDLL_H__ williamr@4: #define __REGPSDLL_H__ williamr@4: williamr@4: williamr@4: williamr@4: #include williamr@4: williamr@4: // forward declarations williamr@4: class RWriteStream; williamr@4: class RReadStream; williamr@4: class RFs; williamr@4: williamr@4: // williamr@4: // Real non-derivable class williamr@4: // williamr@4: class CRegisteredParserDll : public CTimer williamr@4: /** Finds, loads and maintains a reference count of client processes for a BIO williamr@4: parser DLL. williamr@4: williamr@4: When the reference count falls to 0, the class is also responsible for unloading williamr@4: the DLL. The public interface for this class is used only by CBIOServerMtm. williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: { williamr@4: public: williamr@4: IMPORT_C static CRegisteredParserDll* NewL(TDesC& aParserName); williamr@4: williamr@4: IMPORT_C ~CRegisteredParserDll(); williamr@4: williamr@4: inline TInt DllRefCount() const; williamr@4: inline TUidType UidType() const; williamr@4: inline void SetUidType(const TUidType& aUidType); williamr@4: williamr@4: IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aDllLibrary); // Increments reference count if successful or returns error williamr@4: IMPORT_C void ReleaseLibrary(); // Decrements access count williamr@4: // Should be called from destructor of any objects created from the library williamr@4: private: williamr@4: CRegisteredParserDll(const TDesC& aParserName); williamr@4: void ConstructL(); williamr@4: williamr@4: void LoadLibraryL(RFs& aFs); williamr@4: TInt FindFullName(RFs& aFs,TDes& aFullName); williamr@4: williamr@4: private: williamr@4: TUidType iUidType; williamr@4: TPtrC iParserName; williamr@4: RLibrary iParserDllLibrary; williamr@4: TInt iDllRefCount; williamr@4: williamr@4: void RunL(); williamr@4: enum { KReleaseLibraryTimeout = 30000000 }; williamr@4: }; williamr@4: williamr@4: #include williamr@4: #endif