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