Symbian3/PDK/Source/GUID-37D7019C-E3EF-5841-8691-5A865A2B5FD2.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 5 f345bda72bc4
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<?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-37D7019C-E3EF-5841-8691-5A865A2B5FD2" xml:lang="en"><title>Using
CCirBuffer</title><shortdesc>This document describes how to use CCirBuffer. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-4C65D06D-9E80-4C52-8106-954E087AEC47"><title>Before adding/removing objects</title> <p>The buffer itself
is not allocated until the <xref href="GUID-FA17C8AD-BF8C-3FD4-98AE-43AF55A9D318.dita#GUID-FA17C8AD-BF8C-3FD4-98AE-43AF55A9D318/GUID-4658AA47-E3E6-3325-A4DF-FACADFA5BBB2"><apiname>CCirBufBase::SetLengthL()</apiname></xref> member
function is called. Therefore, the first steps must always be to construct
the <xref href="GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623.dita"><apiname>CCirBuffer</apiname></xref> object and then call its <codeph>SetLengthL()</codeph> member
function.</p> <p>Also note that <codeph>SetLengthL()</codeph> can leave so
it's useful to call it under a trap harness.</p> <codeblock id="GUID-3B0EF9D8-0616-5894-92E0-D4CC80CCC876" xml:space="preserve">...
CCirBuffer* cbInt=new CCirBuffer;
TRAPD(ret,cbInt-&gt;SetLengthL(3));            // max capacity is 3
                                            // and allocates buffer
cbInt-&gt;Put(123);     // Can now start adding/removing integer objects
cbInt-&gt;Put(12);
cbInt-&gt;Put(1);
...
delete cbInt;</codeblock> </section>
</conbody></concept>