Symbian3/SDK/Source/GUID-0DEDC917-05C9-5D43-B839-73C043624BE9.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     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 reference
       
    11   PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
       
    12 <reference id="GUID-0DEDC917-05C9-5D43-B839-73C043624BE9" xml:lang="en"><title> circularbuffer:
       
    13 Circular Buffer Example</title><shortdesc>This example demonstrates the how to use the circular buffer classes <apiname>CCirBuf</apiname> and <apiname>CCirBuffer</apiname>. </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody>
       
    14 <section id="GUID-4AF25C42-D4E3-54AC-A493-F17995CF27A0"><title>Purpose</title> <p>This
       
    15 example application shows how to construct and make use of circular buffers
       
    16 containing integers, objects of user defined classes and objects of an R class. </p> </section>
       
    17 <section><title>Download</title> <p>Click on the following link to download
       
    18 the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-07c0d4d4-3e5e-4329-a0c5-e569e89d3a9e.zip" scope="external">circularbuffer .zip</xref></p><p>Click <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-07c0d4d4-3e5e-4329-a0c5-e569e89d3a9e.html" scope="peer"> browse </xref> to view the example code.</p> </section>
       
    19 <section><title>class summary</title><p><xref href="GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623.dita"><apiname>CCirBuffer </apiname></xref> <xref href="GUID-1D73835F-4361-3216-8EFC-669364E3F5E7.dita"><apiname>CCirBuf</apiname></xref> </p></section>
       
    20 <section id="GUID-2B02964A-812A-5838-9A6F-64E4C8D069EF"><title>Design and
       
    21 implementation</title> <p>Class diagram: </p> <fig id="GUID-1424998B-6CBC-5CEF-9A2D-4DBB286F409B">
       
    22 <title>              Circular buffers example class diagram            </title>
       
    23 <image href="GUID-1BDBFC07-A8E8-5150-953D-CA9CFE1CBF16_d0e224881_href.jpg" placement="inline"/>
       
    24 </fig> <p>The example creates a circular buffer of integers using <xref href="GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623.dita#GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623/GUID-600BE94B-72FF-3A44-92EC-3806B7F5E4E5"><apiname>CCirBuffer::Put()</apiname></xref> to
       
    25 add elements and <xref href="GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623.dita#GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623/GUID-112CD6F9-DAB4-30E5-9E5C-B636F8AEEC08"><apiname>CCirBuffer::Get()</apiname></xref> to remove an element.
       
    26 To demonstrate the circular nature of the buffer, the example: </p> <ul>
       
    27 <li id="GUID-950580F8-9810-5172-95AD-7B3C2B933818"><p>adds four elements until
       
    28 the buffer is full, </p> </li>
       
    29 <li id="GUID-28BD6FC5-80AC-5567-94E6-4592A0BD2751"><p>tries to adds another
       
    30 element to the buffer, which fails with a buffer full error message, </p> </li>
       
    31 <li id="GUID-AAB4C513-DB1C-5BEF-9C2E-9CED284A2C58"><p>removes elements 1 and
       
    32 2 from the buffer, leaving elements 3 and 4, </p> </li>
       
    33 <li id="GUID-3DE3EB5E-5080-527B-8C69-92535A6CB6CC"><p>adds two new elements
       
    34 (5 and 6) to the buffer, </p> </li>
       
    35 <li id="GUID-A7CDA10E-DF03-5460-BA7A-1E85B3FC66D8"><p>removes all elements
       
    36 (3, 4, 5 and 6) from the buffer. </p> </li>
       
    37 </ul> <p>Similar steps are performed using <xref href="GUID-1D73835F-4361-3216-8EFC-669364E3F5E7.dita"><apiname>CCirBuf</apiname></xref> to add
       
    38 (<xref href="GUID-1D73835F-4361-3216-8EFC-669364E3F5E7.dita#GUID-1D73835F-4361-3216-8EFC-669364E3F5E7/GUID-1EE35B7E-6E95-3B6A-9EE4-B5CCFA4F772D"><apiname>CCirBuf::Add()</apiname></xref>) and remove (<xref href="GUID-1D73835F-4361-3216-8EFC-669364E3F5E7.dita#GUID-1D73835F-4361-3216-8EFC-669364E3F5E7/GUID-FFCCB7E3-B69F-3CC8-B38C-0179915C1E20"><apiname>CCirBuf::Remove()</apiname></xref>)
       
    39 user-defined objects, and objects of an <codeph>R</codeph> class to and from
       
    40 the buffer. </p> <p>After removing R class objects from the circular buffer,
       
    41 they must be closed in order to release the resource held by the R Class objects. </p> </section>
       
    42 <section id="GUID-6CB8757B-66CF-577C-A490-99CBBC10E2B5"><title>Building and
       
    43 configuring</title> <p>To build the example: </p> <ul>
       
    44 <li id="GUID-48DC5748-F246-57CB-9568-4B49E09A2CAA"><p>You can build the example
       
    45 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file
       
    46 of the example into your IDE, and use the build command of the IDE. </p> <p>If
       
    47 you use the command line, open a command prompt, and set the current directory
       
    48 to the source code directory of the example. You can then build the example
       
    49 with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake
       
    50 bldfiles</userinput> </p> <p><userinput>abld build</userinput> </p> <p><xref href="GUID-793A5EF9-CC16-5EEB-9011-6431EA76EB15.dita">How to use bldmake</xref> and <xref href="GUID-B6B54E07-3B34-5D5C-8815-93383FA8FB4B.dita">How to use abld</xref> describe
       
    51 how to use the SBSv1 build tools. </p> </li>
       
    52 <li id="GUID-DEEF2C1B-2D81-5DA7-BE70-EAD7496B16FA"><p>For the emulator, the
       
    53 example builds an executable called <filepath>circularbuffer.exe</filepath> in
       
    54 the <filepath>epoc32\release\winscw\&lt;udeb or                 urel&gt;\</filepath> folder. </p> </li>
       
    55 </ul> </section>
       
    56 <section id="GUID-BC504F56-2676-5CBB-8DC1-57B3D9DD3950"><title>Running the
       
    57 example</title> <p>The user is prompted to press a key in order to progress
       
    58 from one function to the next. </p> </section>
       
    59 </refbody></reference>