|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-B1D5B680-00E3-5702-985A-94256180E2D8" xml:lang="en"><title>Automatic |
|
13 Resource Management</title><shortdesc>Automatic resource management is designed to increase the baseline |
|
14 usability of Symbian platform for Symbian Developers. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section><title>Need for Automatic resource management</title><p>The use of |
|
16 the Symbian Cleanup Stack is more difficult, error-prone and requires writing |
|
17 extra code for explicit cleanup using the CleanupStack. In contrast, the Symbian |
|
18 C++ class templates for automatic resource management are relatively easier |
|
19 to use. They provide automatic exception-safe cleanup upon normal or exceptional |
|
20 exit from a scope, in which case they do not require writing any code for |
|
21 invoking the cleanup of resources. The resources are automatically cleaned |
|
22 up by the destructors of the template classes in that case. </p></section> |
|
23 <section><title>Characteristics of Automatic resource management</title><p>The |
|
24 following are the characteristics of automatic resource management: </p> <ul> |
|
25 <li id="GUID-3A2FF8D0-FB26-5DBB-AD48-5381FF1BF3FA"><p>Improved usability versus |
|
26 the cleanup stack and the manual authoring of destructors. </p> </li> |
|
27 <li id="GUID-FEA29BB7-4A22-5B38-B729-778799A87C64"><p>Covering data member |
|
28 management as well as local variable management. </p> </li> |
|
29 <li id="GUID-BB5C0699-F7D3-5137-A486-CD9A635195CB"><p>A comprehensive replacement |
|
30 for the existing cleanup stack API. </p> </li> |
|
31 <li id="GUID-BD725E12-50A8-5741-BE49-D5054BA78813"><p>Ability to handle C-classes, |
|
32 R-classes, and custom cleanups. </p> </li> |
|
33 </ul></section> |
|
34 <section><title>Template classes</title><p>The following variants of the class |
|
35 templates for automatic resource management have been provided: </p> <ul> |
|
36 <li id="GUID-B08EC001-AECA-50E0-BAA4-5A9779703350"><p> <xref href="GUID-24AEB510-9FB5-318C-BA1E-C6ACA0BB87BC.dita"><apiname> LCleanedup</apiname></xref> class |
|
37 templates </p> <p>The LCleanedup class templates provided are: </p> <table id="GUID-0D32DEDA-4F92-506E-8335-A0C182ECD7AD"> |
|
38 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/> |
|
39 <thead> |
|
40 <row> |
|
41 <entry>Templates</entry> |
|
42 <entry>Description</entry> |
|
43 </row> |
|
44 </thead> |
|
45 <tbody> |
|
46 <row> |
|
47 <entry><p> <xref href="GUID-BD4E0CC4-75A2-306D-A860-06B4138F86EB.dita"><apiname>LCleanedupPtr </apiname></xref> </p> </entry> |
|
48 <entry><p>Provides automatic management of pointers </p> </entry> |
|
49 </row> |
|
50 <row> |
|
51 <entry><p> <xref href="GUID-9ECEAE0C-3D5A-3B1F-88DD-28B37CE9950D.dita"><apiname> LCleanedupHandle </apiname></xref> </p> </entry> |
|
52 <entry><p>Provides automatic management of resource handles </p> </entry> |
|
53 </row> |
|
54 <row> |
|
55 <entry><p> <xref href="GUID-83938A18-23EF-301A-9D40-C89AEDB5DFF0.dita"><apiname>LCleanedupRef </apiname></xref> </p> </entry> |
|
56 <entry><p>Provides automatic management of object references </p> </entry> |
|
57 </row> |
|
58 <row> |
|
59 <entry><p> <xref href="GUID-A7B3BEBB-3805-3149-A9DB-075FFF3DED3F.dita"><apiname>LCleanedupArray </apiname></xref> </p> </entry> |
|
60 <entry><p>Provides automatic management of C++ style arrays </p> </entry> |
|
61 </row> |
|
62 <row> |
|
63 <entry><p> <xref href="GUID-E6D04730-8064-3846-99E4-FB638C5EAA65.dita"><apiname>LCleanedupGuard </apiname></xref> </p> </entry> |
|
64 <entry><p>Provides automatic generic cleanup </p> </entry> |
|
65 </row> |
|
66 </tbody> |
|
67 </tgroup> |
|
68 </table> </li> |
|
69 <li id="GUID-A97A0B3A-A991-5AA2-B501-5D3DA00A3B6D"><p> <xref href="GUID-7AFEC8E9-22D6-3905-81D2-E514FC1779D8.dita"><apiname>LManaged </apiname></xref> class |
|
70 templates </p> <p>The LManaged class templates provided are: </p> <table id="GUID-49B28928-A504-5931-BBF9-8BDCABD9B380"> |
|
71 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/> |
|
72 <thead> |
|
73 <row> |
|
74 <entry>Templates</entry> |
|
75 <entry>Description</entry> |
|
76 </row> |
|
77 </thead> |
|
78 <tbody> |
|
79 <row> |
|
80 <entry><p> <xref href="GUID-166B7262-50A5-3C2E-B7DD-3291F96B31AA.dita"><apiname> LManagedPtr </apiname></xref> </p> </entry> |
|
81 <entry><p>Provides automatic management of pointers </p> </entry> |
|
82 </row> |
|
83 <row> |
|
84 <entry><p> <xref href="GUID-FCBCB7A9-AF28-3591-A54D-8AF354E01D11.dita"><apiname> LManagedHandle </apiname></xref> </p> </entry> |
|
85 <entry><p>Provides automatic management of resource handles </p> </entry> |
|
86 </row> |
|
87 <row> |
|
88 <entry><p> <xref href="GUID-2F473656-DD2D-33A7-8BC8-BA2C3337849C.dita"><apiname> LManagedRef </apiname></xref> </p> </entry> |
|
89 <entry><p>Provides automatic management of object references </p> </entry> |
|
90 </row> |
|
91 <row> |
|
92 <entry><p> <xref href="GUID-B0B92876-6BE7-3B34-B19D-4B5E318F7BED.dita"><apiname>LManagedArray </apiname></xref> </p> </entry> |
|
93 <entry><p>Provides automatic management of C++ style arrays </p> </entry> |
|
94 </row> |
|
95 <row> |
|
96 <entry><p> <xref href="GUID-577F5B2D-0A1D-31AA-84EB-BE0B39F5A624.dita"><apiname>LManagedGuard </apiname></xref> </p> </entry> |
|
97 <entry><p>Provides automatic generic cleanup </p> </entry> |
|
98 </row> |
|
99 </tbody> |
|
100 </tgroup> |
|
101 </table> </li> |
|
102 </ul></section> |
|
103 <section><title>See Also</title> <p><xref href="GUID-B007634D-4D55-528A-8B85-6120C633AC8B.dita">EUser |
|
104 High Level Overview</xref> </p> <p><xref href="GUID-D33EB877-CCCB-527B-8AFC-4A8385C55E78.dita">EUser |
|
105 High Level Tutorials</xref> </p> </section> |
|
106 </conbody></concept> |