Symbian3/SDK/Source/GUID-48C764A2-378F-57CC-B7F2-EC866AE8F830.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-48C764A2-378F-57CC-B7F2-EC866AE8F830"><title>The reference counting object</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A reference counting object is one which uses reference counting to track concurrent references to itself and which arranges for automatic destruction of itself when the final reference is removed. It is also an object which can be named. </p> <p>A reference counting object is any object which has <codeph>CObject</codeph> as its base class. </p> <p>Constructing a <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> derived type, or calling its <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-E6319811-605D-3329-9314-ED25F4A9116C"><apiname>CObject::Open()</apiname></xref> member function, adds a reference to that object by adding one to its reference count. Calling its <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-6E50F446-307B-3C9D-9AD6-AFCB49B2F658"><apiname>CObject::Close()</apiname></xref> member function removes a reference by subtracting one from its reference count. When the last user of the object calls <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-6E50F446-307B-3C9D-9AD6-AFCB49B2F658"><apiname>CObject::Close()</apiname></xref>, the reference count becomes zero and the object is automatically destroyed. </p> <p>The following drawing shows the idea. </p> <fig id="GUID-18A04428-FBD7-5115-B206-6F2E67343A7F"><image href="GUID-39AAB0D3-6D4D-5DE3-B894-F5E763D3E19B_d0e248344_href.png" placement="inline"/></fig> <p>A <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> is always part of a class hierarchy. It is a base class; an explicit <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> type is never instantiated. </p> <p>The server side implementation of a client/server subsession uses a <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref>. </p> <p>See also: </p> <ul><li id="GUID-20A9F23B-19B5-5D70-9943-811FC42F3BED"><p> <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref>  </p> </li> <li id="GUID-8C980E14-F073-5918-AD66-8547656BC13D"><p> <xref href="GUID-1CC6FEF0-7D1E-5329-8276-22ACFE3DE362.dita">Subsessions within a session</xref>  </p> </li> <li id="GUID-C5FCE438-1F8B-569C-9257-0EBE9D823747"><p> <xref href="GUID-6047DB3F-DC92-51DF-9EEB-00E79E890B54.dita">Using client/server</xref>  </p> </li> </ul> </conbody></concept>
    12 <concept xml:lang="en" id="GUID-48C764A2-378F-57CC-B7F2-EC866AE8F830"><title>The reference counting object</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A reference counting object is one which uses reference counting to track concurrent references to itself and which arranges for automatic destruction of itself when the final reference is removed. It is also an object which can be named. </p> <p>A reference counting object is any object which has <codeph>CObject</codeph> as its base class. </p> <p>Constructing a <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> derived type, or calling its <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-E6319811-605D-3329-9314-ED25F4A9116C"><apiname>CObject::Open()</apiname></xref> member function, adds a reference to that object by adding one to its reference count. Calling its <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-6E50F446-307B-3C9D-9AD6-AFCB49B2F658"><apiname>CObject::Close()</apiname></xref> member function removes a reference by subtracting one from its reference count. When the last user of the object calls <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita#GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97/GUID-6E50F446-307B-3C9D-9AD6-AFCB49B2F658"><apiname>CObject::Close()</apiname></xref>, the reference count becomes zero and the object is automatically destroyed. </p> <p>The following drawing shows the idea. </p> <fig id="GUID-18A04428-FBD7-5115-B206-6F2E67343A7F"><image href="GUID-39AAB0D3-6D4D-5DE3-B894-F5E763D3E19B_d0e244607_href.png" placement="inline"/></fig> <p>A <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> is always part of a class hierarchy. It is a base class; an explicit <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref> type is never instantiated. </p> <p>The server side implementation of a client/server subsession uses a <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref>. </p> <p>See also: </p> <ul><li id="GUID-20A9F23B-19B5-5D70-9943-811FC42F3BED"><p> <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref>  </p> </li> <li id="GUID-8C980E14-F073-5918-AD66-8547656BC13D"><p> <xref href="GUID-1CC6FEF0-7D1E-5329-8276-22ACFE3DE362.dita">Subsessions within a session</xref>  </p> </li> <li id="GUID-C5FCE438-1F8B-569C-9257-0EBE9D823747"><p> <xref href="GUID-6047DB3F-DC92-51DF-9EEB-00E79E890B54.dita">Using client/server</xref>  </p> </li> </ul> </conbody></concept>