Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/class_c_descriptor_examples.html
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 6 43e37759235e
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TB9.2 Example Applications: CDescriptorExamples Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="contents">
<h1>CDescriptorExamples Class Reference</h1><!-- doxytag: class="CDescriptorExamples" -->
<p><a href="class_c_descriptor_examples-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a3508c2638781bb0ff9c0976cc0ff9d0f">CDescriptorExamples</a> (<a class="el" href="class_m_result_viewer.html">MResultViewer</a> *aViewer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a7f529caf8413e46dbb90c73f9b8839da">ToStack</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#abfb8e980e2e7e89daa2b46de2cb98d4a">ToHeapL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#ac09dcbba3fcb7b55391e50c3692052d5">Literals</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#ac45c0edc4bd868c8c21d25ec676f121b">NonModifyingMethods</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a5c4e6afcc42704c6d55ff898f7d5f749">ModifyingMethodsL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#ae51548be0afb3319e849f7ff8ccf440f">CharacterConversionsL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#ace06425c580f03f1bdd084f079de168f">LexicalAnalysis</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a16794acec84adb6c9f9bd53493bfda8f">CircularBuffersL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a7b302d526ed71c8039a1be75d9ceb21a">FlatDynamicBuffersL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a4fbafdaa5db8471d65748de40a0fac1b">SegmentedDynamicBuffersL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#aa3004492a8d6c9ba4aebeb1b81b1f6a3">PackageBuffers</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_descriptor_examples.html#a0c138dfa0a2aa25627963b9fee1b63d5">RBufDemonstrations</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This class declares example methods that describe the usage of descriptors and related APIs. </p>

<p>Definition at line <a class="el" href="_descriptor_examples_8h_source.html#l00041">41</a> of file <a class="el" href="_descriptor_examples_8h_source.html">DescriptorExamples.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a3508c2638781bb0ff9c0976cc0ff9d0f"></a><!-- doxytag: member="CDescriptorExamples::CDescriptorExamples" ref="a3508c2638781bb0ff9c0976cc0ff9d0f" args="(MResultViewer *aViewer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CDescriptorExamples::CDescriptorExamples </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_m_result_viewer.html">MResultViewer</a> *&nbsp;</td>
          <td class="paramname"> <em>aViewer</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This constructor instantiates an object whose example methods are used to demonstrate descriptors and related APIs.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>aViewer</em>&nbsp;</td><td><a class="el" href="class_m_result_viewer.html">MResultViewer</a> object where results are to be written. This doesn't take ownership of given viewer so it has to be deleted after this object is no more used. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_descriptor_examples_8h_source.html#l00053">53</a> of file <a class="el" href="_descriptor_examples_8h_source.html">DescriptorExamples.h</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a7f529caf8413e46dbb90c73f9b8839da"></a><!-- doxytag: member="CDescriptorExamples::ToStack" ref="a7f529caf8413e46dbb90c73f9b8839da" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::ToStack </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Examples in this method describes how to declare each descriptor type as an automatic variable (object allocated to stack). Following issues are covered:</p>
<ul>
<li>how to declare each descriptor type to stack</li>
<li>using code blocks to deallocate unneeded automatic variables </li>
</ul>

<p>Definition at line <a class="el" href="_declaring_descriptors_8cpp_source.html#l00013">13</a> of file <a class="el" href="_declaring_descriptors_8cpp_source.html">DeclaringDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="abfb8e980e2e7e89daa2b46de2cb98d4a"></a><!-- doxytag: member="CDescriptorExamples::ToHeapL" ref="abfb8e980e2e7e89daa2b46de2cb98d4a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::ToHeapL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Examples in this method describes how to allocate descriptors from heap. </p>

<p>Definition at line <a class="el" href="_declaring_descriptors_8cpp_source.html#l00085">85</a> of file <a class="el" href="_declaring_descriptors_8cpp_source.html">DeclaringDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ac09dcbba3fcb7b55391e50c3692052d5"></a><!-- doxytag: member="CDescriptorExamples::Literals" ref="ac09dcbba3fcb7b55391e50c3692052d5" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::Literals </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example method describes how to declare literals. Following issues are covered:</p>
<ul>
<li>declaring literal with macro _LIT</li>
<li>declaring literal with macro _L</li>
<li>declaring unicode characters in literals </li>
</ul>

<p>Definition at line <a class="el" href="_declaring_descriptors_8cpp_source.html#l00121">121</a> of file <a class="el" href="_declaring_descriptors_8cpp_source.html">DeclaringDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ac45c0edc4bd868c8c21d25ec676f121b"></a><!-- doxytag: member="CDescriptorExamples::NonModifyingMethods" ref="ac45c0edc4bd868c8c21d25ec676f121b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::NonModifyingMethods </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example demonstrates usage of non-modifying methods declared the base class of all descriptor, TDesC. </p>

<p>Definition at line <a class="el" href="_manipulating_descriptors_8cpp_source.html#l00032">32</a> of file <a class="el" href="_manipulating_descriptors_8cpp_source.html">ManipulatingDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a5c4e6afcc42704c6d55ff898f7d5f749"></a><!-- doxytag: member="CDescriptorExamples::ModifyingMethodsL" ref="a5c4e6afcc42704c6d55ff898f7d5f749" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::ModifyingMethodsL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example demonstrates usage modifying methods declared the base class of modifying descriptors, TDes. </p>

<p>Definition at line <a class="el" href="_manipulating_descriptors_8cpp_source.html#l00170">170</a> of file <a class="el" href="_manipulating_descriptors_8cpp_source.html">ManipulatingDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ae51548be0afb3319e849f7ff8ccf440f"></a><!-- doxytag: member="CDescriptorExamples::CharacterConversionsL" ref="ae51548be0afb3319e849f7ff8ccf440f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::CharacterConversionsL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example demonstrates how to convert string data encoded with one character set to unicode and vice versa. Conversion of SMS data is used as and example. </p>

<p>Definition at line <a class="el" href="_manipulating_descriptors_8cpp_source.html#l00489">489</a> of file <a class="el" href="_manipulating_descriptors_8cpp_source.html">ManipulatingDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ace06425c580f03f1bdd084f079de168f"></a><!-- doxytag: member="CDescriptorExamples::LexicalAnalysis" ref="ace06425c580f03f1bdd084f079de168f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::LexicalAnalysis </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example demonstrates how numbers in string format can be parsed to binary representation. </p>

<p>Definition at line <a class="el" href="_manipulating_descriptors_8cpp_source.html#l00657">657</a> of file <a class="el" href="_manipulating_descriptors_8cpp_source.html">ManipulatingDescriptors.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a16794acec84adb6c9f9bd53493bfda8f"></a><!-- doxytag: member="CDescriptorExamples::CircularBuffersL" ref="a16794acec84adb6c9f9bd53493bfda8f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::CircularBuffersL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>The first example in this method demonstrates how circular buffer, First In First Out (FIFO) data structure, is used manipulate character data. Each item in the FIFO is instance of TText that is 16 bit character code unicode build and 8 bit character in non-unicode build.</p>
<p>The second example in this method extends the usage to a bit more complex type than a 8 or 16 bit number. An example class is used as an item in structure. </p>

<p>Definition at line <a class="el" href="_other_buffers_8cpp_source.html#l00088">88</a> of file <a class="el" href="_other_buffers_8cpp_source.html">OtherBuffers.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a7b302d526ed71c8039a1be75d9ceb21a"></a><!-- doxytag: member="CDescriptorExamples::FlatDynamicBuffersL" ref="a7b302d526ed71c8039a1be75d9ceb21a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::FlatDynamicBuffersL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This method demonstrates how flat dynamic buffer (CBufFlat) is used to store and alter binary data. 8-bit character data is used as an example data.</p>
<p>Data in CBufFlat lies in one contiguous heap cell. CBufFlat extends the heap cell used to store the contents automatically when so needed. If heap cell can't extend a new cell is allocated, old data copied to new cell and old heap cell deleted.</p>
<p>Data is accessed and modified through base classes methods CBufBase::Read(), CBufBase::Write(), CBufBase::InsertL() and CBufBase::Delete(). Pointer access to data makes sence since data in heap cell is continuous. </p>

<p>Definition at line <a class="el" href="_other_buffers_8cpp_source.html#l00211">211</a> of file <a class="el" href="_other_buffers_8cpp_source.html">OtherBuffers.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a4fbafdaa5db8471d65748de40a0fac1b"></a><!-- doxytag: member="CDescriptorExamples::SegmentedDynamicBuffersL" ref="a4fbafdaa5db8471d65748de40a0fac1b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::SegmentedDynamicBuffersL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example demonstrates how segmented dynamic buffers (CBufSeg) are used to store and alter binary content. 8-bit character data is used as an example data.</p>
<p>CBufSeg splits contents to multiple heap cells having the same size. These cells are called segments of the data. CBufSeg allocates new segments automatically when data storage needs to be enlarged.</p>
<p>Data is accessed and modified through base classes methods CBufBase::Read(), CBufBase::Write(), CBufBase::InsertL() and CBufBase::Delete(). Pointer access is also possible but is difficult since data isn't continuous (like in case of </p>

<p>Definition at line <a class="el" href="_other_buffers_8cpp_source.html#l00276">276</a> of file <a class="el" href="_other_buffers_8cpp_source.html">OtherBuffers.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aa3004492a8d6c9ba4aebeb1b81b1f6a3"></a><!-- doxytag: member="CDescriptorExamples::PackageBuffers" ref="aa3004492a8d6c9ba4aebeb1b81b1f6a3" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::PackageBuffers </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This example method demonstrates how to declare and use package buffers and package pointers.</p>
<p>In typical cases the threads can't access to each others memory areas. However, interthread communication provides a way to read and write to other threads memory. The memory address given for reading or writing must be a descriptor. The actual reading and writing is done by kernel that will make sure that descriptor constraints are respected: buffer is not read or written before its starting index or after end index.</p>
<p>Package buffer capsulates any value object as an binary array that makes it easy pass object or structure of objects to other thread. </p>

<p>Definition at line <a class="el" href="_other_buffers_8cpp_source.html#l00420">420</a> of file <a class="el" href="_other_buffers_8cpp_source.html">OtherBuffers.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a0c138dfa0a2aa25627963b9fee1b63d5"></a><!-- doxytag: member="CDescriptorExamples::RBufDemonstrations" ref="a0c138dfa0a2aa25627963b9fee1b63d5" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CDescriptorExamples::RBufDemonstrations </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Function demonstrates different usages of RBuf. It should be noted that the Create and Assign functions leak memory if the memory for the RBuf isn't freed (i.e calling Close()) before calling them. RBuf was introduced in Symbian OS 9 but was backported to Symbian OS 8. </p>

<p>Definition at line <a class="el" href="_other_buffers_8cpp_source.html#l00472">472</a> of file <a class="el" href="_other_buffers_8cpp_source.html">OtherBuffers.cpp</a>.</p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>