Symbian3/SDK/Source/GUID-7068AB77-5C96-59A3-B975-7923FD843832.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-7068AB77-5C96-59A3-B975-7923FD843832" xml:lang="en"><title>Hash Table - Using Hash Table Classes</title><shortdesc>This example application demonstrates some uses of the
Hash Table APIs of the User Library component</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Hash table is used to construct the following: </p>
<ul>
<li id="GUID-0297A974-34AE-5562-A117-C4B66FAEAD54"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-DD6E1786-8612-5D9F-833C-CC7EA6E7D0C2"> Hash Set</xref>  </p> </li>
<li id="GUID-84E70B2C-E2C0-577E-A505-FADA0208C0FF"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-DB0CE85F-A350-5724-86B3-355494913055">Hash set of pointers</xref>  </p> </li>
<li id="GUID-EBDFB08C-55E7-5FD0-8368-6F1C06343FDE"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-B5E8D195-C16A-5975-B9B7-55C40441FE2C">Hash map</xref>  </p> </li>
<li id="GUID-7ABCD2A4-BC34-53A8-B8CE-236A39EB4004"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-FA5FD086-D250-54FE-9D14-3269C3AE1A85">Hash map of pointers</xref>  </p> </li>
</ul>
<p>The example also demonstrates performing different operations on
these hash sets/maps, such as, inserting, finding, iterating, and
removing items. A set implements an unordered extensional set of objects
and a map implements an associative array with key and value type
using probe sequence hash table. </p>
<p>The overview contains the following sections: </p>
<ul>
<li id="GUID-58254C8A-80EA-576F-96E8-4CAF67AB7E09"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-9027C307-250C-59A1-BC8E-3098817093EB">Download</xref> </p> </li>
<li id="GUID-20680E37-2D18-5D07-8633-09BFD40CBF0C"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-6AF54D67-574E-517D-BB01-E5EB8A48B134">Description</xref>  </p> </li>
<li id="GUID-CDEB1647-B3B4-53F5-9CB8-8D27BA4E4FDF"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-c296a224-8cf5-40fa-9980-4749795c821c">Class summary</xref>  </p> </li>
<li id="GUID-AAB40957-335F-5735-AE03-9CCBE5FEE9B6"><p> <xref href="GUID-7068AB77-5C96-59A3-B975-7923FD843832.dita#GUID-7068AB77-5C96-59A3-B975-7923FD843832/GUID-167C0565-5EFF-5F8E-A4AB-2D1591A9AEFA">Build</xref>  </p> </li>
</ul>
<section id="GUID-9027C307-250C-59A1-BC8E-3098817093EB"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-6ff761c5-3381-4d16-b419-a16bb2da2c74.zip" scope="external">HashTableExample.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-6ff761c5-3381-4d16-b419-a16bb2da2c74.html" scope="peer">browse </xref>to view the example code.</p> </section>
<section id="GUID-6AF54D67-574E-517D-BB01-E5EB8A48B134"><title>Description</title> <p id="GUID-DD6E1786-8612-5D9F-833C-CC7EA6E7D0C2"><b>Hash set</b> </p> <p>The application constructs a hash set by using the default
hash and identity function for integers and descriptors using the <codeph>RHashSet</codeph> template class, and constructs another hash set
by providing a defined custom hash and identity functions. </p> <p>The application applies the following operations to the hash set: </p> <ul>
<li id="GUID-64CFB688-AC3B-57C2-B282-CF330B30B030"><p>Inserting items
using the <xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-A3A636D2-CFCC-30A2-A144-26241B50978F"><apiname>RHashSet::Insert()</apiname></xref> function </p> </li>
<li id="GUID-E94CC014-DCAE-5755-8F7B-EDA09974661D"><p>Finding items
using the <xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-89226347-DCDF-34D3-ADFE-AE135EE353C6"><apiname>RHashSet::Find()</apiname></xref> function </p> </li>
<li id="GUID-ABF21E6D-34E8-5830-8505-2B45A9ECDB7E"><p>Iterating items
using the <xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-BD2A81FF-D6D7-3F60-8204-F8B70A3AD841"><apiname>RHashSet::TIter</apiname></xref> class </p> </li>
<li id="GUID-D7A98E1F-BCAA-5602-8298-64B8ECC4C02F"><p>Removing items
using the <xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-AB5393CB-75FD-317E-9FE5-9D8C3A6D8B40"><apiname>RHashSet::Remove()</apiname></xref> function </p> </li>
</ul><p><b>Related APIs</b></p><ul>
<li><p><xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-89226347-DCDF-34D3-ADFE-AE135EE353C6"><apiname>RHashSet::Find()</apiname></xref></p></li>
<li><p><xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-A3A636D2-CFCC-30A2-A144-26241B50978F"><apiname>RHashSet::Insert()</apiname></xref></p></li>
<li><p><xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-AB5393CB-75FD-317E-9FE5-9D8C3A6D8B40"><apiname>RHashSet::Remove()</apiname></xref></p></li>
<li><p><xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita#GUID-1851A507-A5A9-356F-88A4-494066F43499/GUID-BD2A81FF-D6D7-3F60-8204-F8B70A3AD841"><apiname>RHashSet::TIter</apiname></xref> - A class which allows iteration
over the elements of a <xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita"><apiname>RHashSet</apiname></xref>class.</p></li>
</ul> <p id="GUID-DB0CE85F-A350-5724-86B3-355494913055"><b>Hash set
of pointers </b> </p> <p>The application constructs a hash set of
pointers using the default hash and identity function for integers
and descriptors using the <codeph>RPtrHashSet</codeph> template class,
and constructs another hash set of pointers by providing a defined
custom hash and identity functions. </p> <p>The application applies
the following operations to the hash set of pointers: </p> <ul>
<li id="GUID-33095E62-B5FE-505A-A7AC-4F6E2A3199AC"><p>Inserting items
using the <xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-03FDA5C9-EE31-372F-AA5B-6954DCD3D3DF"><apiname>RPtrHashSet::Insert()</apiname></xref> function </p> </li>
<li id="GUID-AA8AA483-3904-5597-9DFC-2B294F594ACE"><p>Finding items
using the <xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-1A11BF5E-8BCC-38F6-94E0-5B98AF7A3B73"><apiname>RPtrHashSet::Find()</apiname></xref> function </p> </li>
<li id="GUID-6D4CF84F-4D82-5022-9035-AA07EC0343C6"><p>Iterating items
using the <xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-F748E184-32DA-37B6-B582-CB79242F15C7"><apiname>RPtrHashSet::TIter</apiname></xref> class </p> </li>
<li id="GUID-C763CD87-F13B-565E-BB5A-0ADE43748A8B"><p>Removing items
using the <xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-B2484300-2961-32E7-976A-3BDAFA54664F"><apiname>RPtrHashSet::Remove()</apiname></xref> function </p> </li>
</ul><p><b>Related APIs</b></p><ul>
<li><p><xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-1A11BF5E-8BCC-38F6-94E0-5B98AF7A3B73"><apiname>RPtrHashSet::Find()</apiname></xref></p></li>
<li><p><xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-03FDA5C9-EE31-372F-AA5B-6954DCD3D3DF"><apiname>RPtrHashSet::Insert()</apiname></xref></p></li>
<li><p><xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-B2484300-2961-32E7-976A-3BDAFA54664F"><apiname>RPtrHashSet::Remove()</apiname></xref></p></li>
<li><p><xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita#GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2/GUID-F748E184-32DA-37B6-B582-CB79242F15C7"><apiname>RPtrHashSet::TIter</apiname></xref> - A class which allows
iteration over the elements of a <xref href="GUID-8BE7A907-FF70-3D91-B90A-E394CBBCDBF2.dita"><apiname>RPtrHashSet</apiname></xref> class</p></li>
</ul> <p id="GUID-B5E8D195-C16A-5975-B9B7-55C40441FE2C"><b>Hash map </b> </p> <p>The application constructs a hash map using the default
hash and identity function for integers and descriptors using the <codeph>RHashMap</codeph> template class, and constructs another hash map
by providing a defined custom hash and identity functions. </p> <p>The application applies the following operations to the hash map: </p> <ul>
<li id="GUID-847FFA28-0849-5310-8224-B7F1240506FE"><p>Inserting items
using the <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-266CBFD6-299B-37A3-A769-ACF84CABBA20"><apiname>RHashMap::Insert()</apiname></xref> function </p> </li>
<li id="GUID-1EEC4933-8AAF-522C-BE70-03975C3BAC3D"><p>Finding items
using the <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-DB699FE0-AF9C-39C6-8361-4ED82B3DAAD4"><apiname>RHashMap::Find()</apiname></xref> function </p> </li>
<li id="GUID-E98D034D-FE29-52D7-A4A1-3A0E584BAADB"><p>Iterating items
using the <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-156B9E51-634B-3605-901B-598F6DBEFF54"><apiname>RHashMap::TIter</apiname></xref> class </p> </li>
<li id="GUID-923C5156-7A0E-595B-898A-F6617C474CF6"><p>Removing items
using the <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-9EABABAA-91DB-3EC7-A1A1-385A05AF5067"><apiname>RHashMap::Remove()</apiname></xref> function </p> </li>
</ul><ul>
<li><p><xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-DB699FE0-AF9C-39C6-8361-4ED82B3DAAD4"><apiname>RHashMap::Find()</apiname></xref></p></li>
<li><p><xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-266CBFD6-299B-37A3-A769-ACF84CABBA20"><apiname>RHashMap::Insert()</apiname></xref></p></li>
<li><p><xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-9EABABAA-91DB-3EC7-A1A1-385A05AF5067"><apiname>RHashMap::Remove()</apiname></xref></p></li>
<li><p> <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita#GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6/GUID-156B9E51-634B-3605-901B-598F6DBEFF54"><apiname>RHashMap::TIter</apiname></xref> - A class which allows
iteration over the elements of a <xref href="GUID-66EC84D0-531B-37DF-B3F4-41574CF941A6.dita"><apiname>RHashMap</apiname></xref> class.</p></li>
</ul> <p id="GUID-FA5FD086-D250-54FE-9D14-3269C3AE1A85"><b> Hash map
of pointers</b> </p> <p>The application constructs a hash map of pointers
using the default hash and identity function for integers and descriptors
using the <codeph>RPtrHashMap</codeph> template class, and constructs
another hash map of pointers by providing a defined custom hash and
identity functions. </p> <p>The application applies the following
operations to the hash map of pointers: </p> <ul>
<li id="GUID-2AE0796E-ADAD-5746-8E79-252247445517"><p>Inserting items
using the <xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-576450FC-6E12-31F5-8911-F1B7648FC53E"><apiname>RPtrHashMap::Insert()</apiname></xref> function </p> </li>
<li id="GUID-AB3AA2A9-62A3-542D-9C13-5E91D2C2FB11"><p>Finding items
using the <xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-CE659124-11FF-30CB-8D9C-EF37A9BB19C5"><apiname>RPtrHashMap::Find()</apiname></xref> function </p> </li>
<li id="GUID-4A4327BF-55A0-5456-B583-57374497EB91"><p>Iterating items
using the <xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-69586D97-8AA4-36C4-B32D-2262B305DF90"><apiname>RPtrHashMap::TIter</apiname></xref> class </p> </li>
<li id="GUID-BF7D6522-7E3D-56FD-8247-CFEB5F0F21F3"><p>Removing items
using the <xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-85A25E04-95BA-377F-A462-1BE5917D2A27"><apiname>RPtrHashMap::Remove()</apiname></xref> function </p> </li>
</ul><p><b>Related APIs</b></p><ul>
<li><p><xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-CE659124-11FF-30CB-8D9C-EF37A9BB19C5"><apiname>RPtrHashMap::Find()</apiname></xref></p></li>
<li><p><xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-576450FC-6E12-31F5-8911-F1B7648FC53E"><apiname>RPtrHashMap::Insert()</apiname></xref></p></li>
<li><p><xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-85A25E04-95BA-377F-A462-1BE5917D2A27"><apiname>RPtrHashMap::Remove()</apiname></xref></p></li>
<li><p><xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita#GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225/GUID-69586D97-8AA4-36C4-B32D-2262B305DF90"><apiname>RPtrHashMap::TIter</apiname></xref> - A class which allows
iteration over the elements of a<xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita"><apiname> RPtrHashMap</apiname></xref> class.</p></li>
</ul> </section>
<section id="GUID-C296A224-8CF5-40FA-9980-4749795C821C"><title>Class
summary</title><ul>
<li><p><xref href="GUID-A60735E7-3919-3DDB-AC74-5386C4C5BC51.dita"><apiname>DefaultHash</apiname></xref> - A set of common hashing functions
for frequently occurring types.</p></li>
<li><p><xref href="GUID-6634A181-A764-3CC4-BDB6-B51219D2C9CD.dita"><apiname>DefaultIdentity</apiname></xref> - A set of common identity
relations for frequently occurring types.</p></li>
<li><p><xref href="GUID-F57D0831-3AD2-3C2F-A1CB-C0A1BE541B73.dita"><apiname>THashFunctions32</apiname></xref></p></li>
<li><p><xref href="GUID-E75F040A-CEC6-3751-8F96-F16AEDC209A3.dita"><apiname>TIdentityRelation</apiname></xref></p></li>
<li><p><xref href="GUID-1851A507-A5A9-356F-88A4-494066F43499.dita"><apiname>RHashSet</apiname></xref> </p></li>
<li><p><xref href="GUID-616B71F7-B0A8-31F9-BCF1-FB736EC7E225.dita"><apiname>RPtrHashMap</apiname></xref></p></li>
</ul></section>
<section id="GUID-167C0565-5EFF-5F8E-A4AB-2D1591A9AEFA"><title>Build</title> <p>The Symbian build process describes how to build an application. </p> <p>The HashTableExample builds an executable called <filepath>hashtableexample.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\&lt;build_variant&gt;</filepath> for CodeWarrior).
After launching the executable, depending on the emulator you are
using, you may need to navigate away from the application launcher/shell
screen to view the console. </p> </section>
</conbody></concept>