<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title> TemplateOSCLMemAutoPtr&lt; T, _Allocator &gt; class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<hr><h1>OSCLMemAutoPtr&lt; T, _Allocator &gt; Class Template Reference<br>
<small>
[<a class="el" href="group__osclmemory.html">OSCL Memory</a>]</small>
</h1>The oscl_auto_ptr class is a template class that defines a pointer like object intended to be assigned an address obtanined (directly or or indirectly) by new. When the oscl_auto_ptr expires, its destructor uses delete to free the memory. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="oscl__mem__auto__ptr_8h-source.html">oscl_mem_auto_ptr.h</a>&gt;</code>
<p>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a0">OSCLMemAutoPtr</a> (T *inPtr=0)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Default constructor Initializes the pointer and takes ownership.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a1">OSCLMemAutoPtr</a> (const OSCLMemAutoPtr&lt; T &gt; &amp;_Y)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Copy constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>OSCLMemAutoPtr&lt; T, _Allocator &gt; &amp;&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a2">operator=</a> (const OSCLMemAutoPtr&lt; T, _Allocator &gt; &amp;_Y)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Assignment operator from an another oscl_auto_ptr.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a3">~OSCLMemAutoPtr</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Destructor.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>T &amp;&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a4">operator *</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>The indirection operator (*) accesses a value indirectly, through a pointer.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a5">operator-&gt;</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>The indirection operator (-&gt;) accesses a value indirectly, through a pointer.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a6">takeOwnership</a> (T *ptr)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>The takeOwnership function assigns the value with ownership.</em> <a href="#a6"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a7">allocate</a> (<a class="el" href="osclconfig__ansi__memory_8h.html#a1">oscl_memsize_t</a> size)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a8">setWithoutOwnership</a> (T *ptr)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>The takeOwnership function assigns the value with ownership.</em> <a href="#a8"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a9">get</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOSCLMemAutoPtr.html#a9">get()</a> method returns the pointer, currently owned by the class.</em> <a href="#a9"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#a10">release</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOSCLMemAutoPtr.html#a10">release()</a> method releases ownership of the pointer, currently owned by the class. It returns the pointer as well.</em> <a href="#a10"></a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#d0">deallocate</a> (T *ptr)</td></tr>
<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classOSCLMemAutoPtr.html#m0">_Ownership</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt;<br>
 class OSCLMemAutoPtr&lt; T, _Allocator &gt;</h3>

The oscl_auto_ptr class is a template class that defines a pointer like object intended to be assigned an address obtanined (directly or or indirectly) by new. When the oscl_auto_ptr expires, its destructor uses delete to free the memory.
<p>
The purpose of this class is to provide a way to prevent accidental memory leaks in a class or a method, due to "not remembering to delete" variables allocated on the heap. Thus if you assign an address returned by new to an oscl_auto_ptr object, you don't have to remember to free the memory later, it will be freed automatically when the object goes out of scope. The oscl_auto_ptr is an example of a smart pointer, an object that acts like a pointer, but with additional features. The class is defined so that it acts like a regular pointer in most respects 
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="OSCLMemAutoPtr::OSCLMemAutoPtr"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> OSCLMemAutoPtr&lt; T, _Allocator &gt;::OSCLMemAutoPtr </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>inPtr</em> = 0          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline, explicit]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Default constructor Initializes the pointer and takes ownership.
<p>
    </td>
  </tr>
</table>
<a name="a1" doxytag="OSCLMemAutoPtr::OSCLMemAutoPtr"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> OSCLMemAutoPtr&lt; T, _Allocator &gt;::OSCLMemAutoPtr </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const OSCLMemAutoPtr&lt; T &gt; &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>_Y</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Copy constructor.
<p>
Initializes the pointer and takes ownership from another oscl_auto_ptr. Note that the other class does NOT own the pointer any longer, and hence it is NOT its responsibility to free it.     </td>
  </tr>
</table>
<a name="a3" doxytag="OSCLMemAutoPtr::~OSCLMemAutoPtr"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> OSCLMemAutoPtr&lt; T, _Allocator &gt;::~OSCLMemAutoPtr </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Destructor.
<p>
The pointer is deleted in case this class still has ownership     </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a7" doxytag="OSCLMemAutoPtr::allocate"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void OSCLMemAutoPtr&lt; T, _Allocator &gt;::allocate </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="osclconfig__ansi__memory_8h.html#a1">oscl_memsize_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>size</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a name="d0" doxytag="OSCLMemAutoPtr::deallocate"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void OSCLMemAutoPtr&lt; T, _Allocator &gt;::deallocate </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ptr</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline, static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a name="a9" doxytag="OSCLMemAutoPtr::get"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> T* OSCLMemAutoPtr&lt; T, _Allocator &gt;::get </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<a class="el" href="classOSCLMemAutoPtr.html#a9">get()</a> method returns the pointer, currently owned by the class.
<p>
    </td>
  </tr>
</table>
<a name="a4" doxytag="OSCLMemAutoPtr::operator *"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> T&amp; OSCLMemAutoPtr&lt; T, _Allocator &gt;::operator * </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The indirection operator (*) accesses a value indirectly, through a pointer.
<p>
This operator ensures that the OSCLMemAutoPtr can be used like the regular pointer that it was initialized with.     </td>
  </tr>
</table>
<a name="a5" doxytag="OSCLMemAutoPtr::operator->"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> T* OSCLMemAutoPtr&lt; T, _Allocator &gt;::operator-&gt; </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The indirection operator (-&gt;) accesses a value indirectly, through a pointer.
<p>
This operator ensures that the OSCLMemAutoPtr can be used like the regular pointer that it was initialized with.     </td>
  </tr>
</table>
<a name="a2" doxytag="OSCLMemAutoPtr::operator="></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> OSCLMemAutoPtr&lt;T, _Allocator&gt;&amp; OSCLMemAutoPtr&lt; T, _Allocator &gt;::operator= </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const OSCLMemAutoPtr&lt; T, _Allocator &gt; &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>_Y</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Assignment operator from an another oscl_auto_ptr.
<p>
<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>_Y</em>&nbsp;</td><td>
The value parameter should be another oscl_auto_ptr </td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
Returns a reference to this oscl_auto_ptr instance with pointer initialized. </dl><dl compact><dt><b>Precondition: </b></dt><dd>
The input class should be non-null and should point to a valid pointer.</dl>This assignment operator initializes the class to the contents of the oscl_auto_ptr given as the input parameter. The ownership of the pointer is transferred.     </td>
  </tr>
</table>
<a name="a10" doxytag="OSCLMemAutoPtr::release"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> T* OSCLMemAutoPtr&lt; T, _Allocator &gt;::release </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<a class="el" href="classOSCLMemAutoPtr.html#a10">release()</a> method releases ownership of the pointer, currently owned by the class. It returns the pointer as well.
<p>
    </td>
  </tr>
</table>
<a name="a8" doxytag="OSCLMemAutoPtr::setWithoutOwnership"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void OSCLMemAutoPtr&lt; T, _Allocator &gt;::setWithoutOwnership </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ptr</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The takeOwnership function assigns the value with ownership.
<p>
    </td>
  </tr>
</table>
<a name="a6" doxytag="OSCLMemAutoPtr::takeOwnership"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void OSCLMemAutoPtr&lt; T, _Allocator &gt;::takeOwnership </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ptr</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The takeOwnership function assigns the value with ownership.
<p>
    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a name="m0" doxytag="OSCLMemAutoPtr::_Ownership"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" colspan="4">
template&lt;class T, class _Allocator = Oscl_TAlloc&lt;T, OsclMemAllocator&gt;&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> bool OSCLMemAutoPtr&lt; T, _Allocator &gt;::_Ownership
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="oscl__mem__auto__ptr_8h-source.html">oscl_mem_auto_ptr.h</a></ul>
<hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
</small></address>
</body>
</html>