os/ossrv/genericopenlibs/openenvcore/libdl/inc/loadeddlls.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Name        : loadeddlls.h
    16 * Part of     : libdl library
    17 * Header file for loadeddlls.cpp
    18 * 
    19 *
    20 */
    21 
    22 
    23 
    24 
    25 #ifndef _LOADEDDLLS_H_
    26 #define _LOADEDDLLS_H_
    27 
    28 // INCLUDE FILES
    29 #include <e32base.h>//class CBase
    30 #include <f32image.h>//E32EmulExpSymInfoHdr, E32EpocExpSymInfoHdr
    31 
    32 
    33 #if defined(__WINSCW__) || defined(__WINS__)
    34 typedef E32EmulExpSymInfoHdr TE32ExpSymInfoHdr;
    35 #else
    36 typedef E32EpocExpSymInfoHdr TE32ExpSymInfoHdr;
    37 #endif
    38 
    39 //-----------------------------------------------------------------------
    40 //Class name: TDllEntry
    41 //Description: It represents the item of CLoadedDlls, contains the data item
    42 //				like library object, reference count etc
    43 //-----------------------------------------------------------------------
    44 class TDllEntry 
    45 	{
    46 public:
    47 	static	TBool CompareByHandle(const TDllEntry& aEntry1, const TDllEntry& aEntry2);
    48 	static  TBool CompareByPath(const TDllEntry& aEntry1, const TDllEntry& aEntry2);
    49 	TDllEntry() {}
    50 	TDllEntry(const TInt aHandle) { iLibrary.SetHandle(aHandle); }
    51 	TDllEntry(const RLibrary& aLibrary, const TInt aFlag = 0);
    52 
    53 	RLibrary iLibrary;
    54 	TE32ExpSymInfoHdr* iSymbolHeader;
    55 	TInt iFlags;
    56 	TInt iRefCount;
    57 	};
    58 	
    59 //-----------------------------------------------------------------------
    60 //Class name: CLoadedDlls
    61 //Description: It represents the list of the opened dlls. It is the main 
    62 //			 class to manipulate the data on the opened dlls.
    63 //-----------------------------------------------------------------------
    64 NONSHARABLE_CLASS(CLoadedDlls) : public CBase
    65 	{
    66 public:
    67 	CLoadedDlls();
    68 	~CLoadedDlls();
    69 	TInt Find(const void* aHandle) const;
    70 	TInt Find(const RLibrary& aLibrary) const;
    71  	TInt Add(const TDllEntry& aDllItem);
    72 	void Remove(const TInt aIndex);
    73 	TDllEntry& At(const TInt aIndex);
    74 	inline TInt CreateLock(){	return iLock.CreateLocal();	}
    75 	inline void Lock() { iLock.Wait();	}
    76 	inline void UnLock() { iLock.Signal();	}
    77 	inline TInt Count() const 	{ return iHandleList.Count();}	
    78 private:
    79 	RFastLock iLock;
    80 	RArray<TDllEntry> iHandleList;
    81 	};
    82 
    83 #endif //_LOADEDDLLS_H_