Symbian3/SDK/Source/GUID-B1D5B680-00E3-5702-985A-94256180E2D8.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-B1D5B680-00E3-5702-985A-94256180E2D8" xml:lang="en"><title>Automatic
Resource Management</title><shortdesc>Automatic resource management is designed to increase the baseline
usability of the Symbian platform for Symbian Developers. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-91B268D4-835A-46C8-B5E8-6C99580C2BF1"><title>Need for Automatic resource management</title><p>The use of
the Symbian Cleanup Stack is more difficult, error-prone and requires writing
extra code for explicit cleanup using the CleanupStack. In contrast, the Symbian
C++ class templates for automatic resource management are relatively easier
to use. They provide automatic exception-safe cleanup upon normal or exceptional
exit from a scope, in which case they do not require writing any code for
invoking the cleanup of resources. The resources are automatically cleaned
up by the destructors of the template classes in that case. </p></section>
<section id="GUID-C6274809-F4F2-4F24-9911-52F9E9EAE650"><title>Characteristics of Automatic resource management</title><p>The
following are the characteristics of automatic resource management: </p> <ul>
<li id="GUID-3A2FF8D0-FB26-5DBB-AD48-5381FF1BF3FA"><p>Improved usability versus
the cleanup stack and the manual authoring of destructors. </p> </li>
<li id="GUID-FEA29BB7-4A22-5B38-B729-778799A87C64"><p>Covering data member
management as well as local variable management. </p> </li>
<li id="GUID-BB5C0699-F7D3-5137-A486-CD9A635195CB"><p>A comprehensive replacement
for the existing cleanup stack API. </p> </li>
<li id="GUID-BD725E12-50A8-5741-BE49-D5054BA78813"><p>Ability to handle C-classes,
R-classes, and custom cleanups. </p> </li>
</ul></section>
<section id="GUID-0178F1B0-A710-45A9-ACC4-85401FE905AD"><title>Template classes</title><p>The following variants of the class
templates for automatic resource management have been provided: </p> <ul>
<li id="GUID-B08EC001-AECA-50E0-BAA4-5A9779703350"><p> <xref href="GUID-24AEB510-9FB5-318C-BA1E-C6ACA0BB87BC.dita"><apiname> LCleanedup</apiname></xref> class
templates </p> <p>The LCleanedup class templates provided are: </p> <table id="GUID-0D32DEDA-4F92-506E-8335-A0C182ECD7AD">
<tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
<thead>
<row>
<entry>Templates</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <xref href="GUID-BD4E0CC4-75A2-306D-A860-06B4138F86EB.dita"><apiname>LCleanedupPtr </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of pointers </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-9ECEAE0C-3D5A-3B1F-88DD-28B37CE9950D.dita"><apiname> LCleanedupHandle </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of resource handles </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-83938A18-23EF-301A-9D40-C89AEDB5DFF0.dita"><apiname>LCleanedupRef </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of object references </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-A7B3BEBB-3805-3149-A9DB-075FFF3DED3F.dita"><apiname>LCleanedupArray </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of C++ style arrays </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-E6D04730-8064-3846-99E4-FB638C5EAA65.dita"><apiname>LCleanedupGuard </apiname></xref>  </p> </entry>
<entry><p>Provides automatic generic cleanup </p> </entry>
</row>
</tbody>
</tgroup>
</table> </li>
<li id="GUID-A97A0B3A-A991-5AA2-B501-5D3DA00A3B6D"><p> <xref href="GUID-7AFEC8E9-22D6-3905-81D2-E514FC1779D8.dita"><apiname>LManaged </apiname></xref> class
templates </p> <p>The LManaged class templates provided are: </p> <table id="GUID-49B28928-A504-5931-BBF9-8BDCABD9B380">
<tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
<thead>
<row>
<entry>Templates</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <xref href="GUID-166B7262-50A5-3C2E-B7DD-3291F96B31AA.dita"><apiname> LManagedPtr </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of pointers </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-FCBCB7A9-AF28-3591-A54D-8AF354E01D11.dita"><apiname> LManagedHandle </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of resource handles </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-2F473656-DD2D-33A7-8BC8-BA2C3337849C.dita"><apiname> LManagedRef </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of object references </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-B0B92876-6BE7-3B34-B19D-4B5E318F7BED.dita"><apiname>LManagedArray </apiname></xref>  </p> </entry>
<entry><p>Provides automatic management of C++ style arrays </p> </entry>
</row>
<row>
<entry><p> <xref href="GUID-577F5B2D-0A1D-31AA-84EB-BE0B39F5A624.dita"><apiname>LManagedGuard </apiname></xref>  </p> </entry>
<entry><p>Provides automatic generic cleanup </p> </entry>
</row>
</tbody>
</tgroup>
</table> </li>
</ul></section>
<section id="GUID-E204CB7C-E0A0-4E96-9BA8-DD7D69A2E90F"><title>See Also</title> <p><xref href="GUID-B007634D-4D55-528A-8B85-6120C633AC8B.dita">EUser
High Level Overview</xref>  </p> <p><xref href="GUID-D33EB877-CCCB-527B-8AFC-4A8385C55E78.dita">EUser
High Level Tutorials</xref>  </p> </section>
</conbody></concept>