Symbian3/SDK/Source/GUID-074F3499-54FE-58BC-A0F4-D8EA632AF76B.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept xml:lang="en" id="GUID-074F3499-54FE-58BC-A0F4-D8EA632AF76B"><title>Externalising a Swizzle</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Typically, externalizing a Swizzle is a two stage process which involves:</p> <ul><li id="GUID-EB65444C-7693-53BB-B3B8-D072F80B0CFD"><p>externalizing the in-memory object which the Swizzle represents, to its own stream</p> </li> <li id="GUID-90A275E2-B9C2-5162-ADBA-1035102A93E1"><p>externalizing the resulting stream ID.</p> </li> </ul> <p>For example, given a container type object, <codeph>CClassABC</codeph>, with a data member <codeph>TSwizzle&lt;CClassB&gt; iB</codeph> representing a <codeph>CClassB</codeph> object in memory, the diagram below illustrates the result of storing the container object.</p> <fig id="GUID-E32084CE-13EE-5F32-A62E-A57C30768AE2"><image href="GUID-530AB0D9-BE70-5892-BFBA-213687CA62D1_d0e363478_href.png" placement="inline"/></fig> <p>The following code fragments illustrates the process.</p> <p><codeph>iB</codeph> is a <codeph>CClassB</codeph> type component of a class <codeph>CClassABC</codeph>, and is represented by a Swizzle. The data member is defined as:</p> <codeblock id="GUID-9751293C-D5CD-5397-97F3-C0E5F4A877DF" xml:space="preserve">class CCClassABC : public CBase
    12 <concept xml:lang="en" id="GUID-074F3499-54FE-58BC-A0F4-D8EA632AF76B"><title>Externalising a Swizzle</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Typically, externalizing a Swizzle is a two stage process which involves:</p> <ul><li id="GUID-EB65444C-7693-53BB-B3B8-D072F80B0CFD"><p>externalizing the in-memory object which the Swizzle represents, to its own stream</p> </li> <li id="GUID-90A275E2-B9C2-5162-ADBA-1035102A93E1"><p>externalizing the resulting stream ID.</p> </li> </ul> <p>For example, given a container type object, <codeph>CClassABC</codeph>, with a data member <codeph>TSwizzle&lt;CClassB&gt; iB</codeph> representing a <codeph>CClassB</codeph> object in memory, the diagram below illustrates the result of storing the container object.</p> <fig id="GUID-E32084CE-13EE-5F32-A62E-A57C30768AE2"><image href="GUID-530AB0D9-BE70-5892-BFBA-213687CA62D1_d0e357398_href.png" placement="inline"/></fig> <p>The following code fragments illustrates the process.</p> <p><codeph>iB</codeph> is a <codeph>CClassB</codeph> type component of a class <codeph>CClassABC</codeph>, and is represented by a Swizzle. The data member is defined as:</p> <codeblock id="GUID-9751293C-D5CD-5397-97F3-C0E5F4A877DF" xml:space="preserve">class CCClassABC : public CBase
    13     {
    13     {
    14     ...
    14     ...
    15     TSwizzle&lt;CClassB&gt; iB;
    15     TSwizzle&lt;CClassB&gt; iB;
    16     ...
    16     ...
    17     }
    17     }
    43     {
    43     {
    44     ...
    44     ...
    45     aStream &lt;&lt; iB
    45     aStream &lt;&lt; iB
    46     ...
    46     ...
    47     }
    47     }
    48 </codeblock> <p>At this point, the Swizzle still represents the <codeph>CClassB</codeph> object as a pointer, and the object itself is still in memory.</p> <p>The mechanism underlying the implementation of the stream <codeph>operator&lt;&lt;</codeph>, assumes that the stream ID associated with the Swizzle has been placed in the store map. It also assumes that the <codeph>RStoreWriteStream</codeph> object has been constructed, specifying the store map as an externalizer.</p> <p>The end result of the operation <codeph>aStream &lt;&lt; iB;</codeph>, is to externalise, to the stream, the stream ID associated with the Swizzle <codeph>iB</codeph>. The following diagram shows this:</p> <fig id="GUID-0958AA91-661B-54EA-B540-067DB933169D"><image href="GUID-DD764F2C-365A-5A5C-9412-4AF2EDB16924_d0e363662_href.png" placement="inline"/></fig> </conbody></concept>
    48 </codeblock> <p>At this point, the Swizzle still represents the <codeph>CClassB</codeph> object as a pointer, and the object itself is still in memory.</p> <p>The mechanism underlying the implementation of the stream <codeph>operator&lt;&lt;</codeph>, assumes that the stream ID associated with the Swizzle has been placed in the store map. It also assumes that the <codeph>RStoreWriteStream</codeph> object has been constructed, specifying the store map as an externalizer.</p> <p>The end result of the operation <codeph>aStream &lt;&lt; iB;</codeph>, is to externalise, to the stream, the stream ID associated with the Swizzle <codeph>iB</codeph>. The following diagram shows this:</p> <fig id="GUID-0958AA91-661B-54EA-B540-067DB933169D"><image href="GUID-DD764F2C-365A-5A5C-9412-4AF2EDB16924_d0e357582_href.png" placement="inline"/></fig> </conbody></concept>