messagingfw/biomsgfw/BIUTINC/REGPSDLL.H
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
child 58 6c34d0baa0b1
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 1999-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 // A revised version of the CRegisteredParserDll class.  This no longer uses a 
       
    15 // reference to a CParserRegistrationData object.  Instead a UidType is passed in 
       
    16 // the  constructor, or through a set method.  The class is used to find the file 
       
    17 // which contains a parser, to load and maintain a reference count of the number of 
       
    18 // objects using the dll, so that it can be unloaded when no longer required. 
       
    19 // It will also unload the dll when a new parser is required.
       
    20 // 
       
    21 //
       
    22 
       
    23 
       
    24 
       
    25 #ifndef __REGPSDLL_H__
       
    26 #define __REGPSDLL_H__
       
    27 
       
    28 
       
    29 
       
    30 #include <e32base.h>
       
    31 
       
    32 // forward declarations
       
    33 class RWriteStream;
       
    34 class RReadStream;
       
    35 class RFs;
       
    36 
       
    37 //
       
    38 //  Real non-derivable class
       
    39 //
       
    40 class CRegisteredParserDll : public CTimer
       
    41 /** Finds, loads and maintains a reference count of client processes for a BIO 
       
    42 parser DLL.
       
    43 
       
    44 When the reference count falls to 0, the class is also responsible for unloading 
       
    45 the DLL. The public interface for this class is used only by CBIOServerMtm. 
       
    46 @publishedAll
       
    47 @released
       
    48 */
       
    49 	{
       
    50 public:
       
    51     IMPORT_C static CRegisteredParserDll* NewL(TDesC& aParserName);
       
    52 
       
    53     IMPORT_C ~CRegisteredParserDll();
       
    54 
       
    55 	inline TInt DllRefCount() const;
       
    56 	inline TUidType UidType() const;
       
    57 	inline void SetUidType(const TUidType& aUidType);
       
    58 
       
    59 	IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aDllLibrary);   // Increments reference count if successful or returns error 
       
    60 	IMPORT_C void ReleaseLibrary();                                   // Decrements access count
       
    61 	                                                                  // Should be called from destructor of any objects created from the library 
       
    62 private:
       
    63 	CRegisteredParserDll(const TDesC& aParserName);
       
    64     void ConstructL();
       
    65 
       
    66 	void LoadLibraryL(RFs& aFs);   
       
    67 	TInt FindFullName(RFs& aFs,TDes& aFullName); 
       
    68 
       
    69 private:
       
    70 	TUidType iUidType;
       
    71     TPtrC iParserName;
       
    72 	RLibrary iParserDllLibrary;
       
    73 	TInt iDllRefCount;
       
    74 
       
    75     void RunL();
       
    76     enum { KReleaseLibraryTimeout = 30000000 };
       
    77 	};
       
    78 
       
    79 #include <regpsdll.inl>
       
    80 #endif