blob: 18cb5e54823744bfda7805d895ef65b7c7e2fef5 [file] [log] [blame]
<!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> TemplateOsclExclusiveArrayPtr&lt; T &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>OsclExclusiveArrayPtr&lt; T &gt; Class Template Reference<br>
<small>
[<a class="el" href="group__osclbase.html">OSCL Base</a>]</small>
</h1>The OsclExclusiveArrayPtr class is a template class that defines an array pointer like object intended to be assigned an address obtanined (directly or or indirectly) by new. When the OsclExclusiveArrayPtr expires, its destructor uses delete to free the memory.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="oscl__exclusive__ptr_8h-source.html">oscl_exclusive_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="classOsclExclusiveArrayPtr.html#a0">OsclExclusiveArrayPtr</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="classOsclExclusiveArrayPtr.html#a1">OsclExclusiveArrayPtr</a> (OsclExclusiveArrayPtr&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>OsclExclusiveArrayPtr&lt; T &gt; &amp;&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusiveArrayPtr.html#a2">operator=</a> (OsclExclusiveArrayPtr&lt; T &gt; &amp;_Y)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Assignment operator from an another OsclExclusiveArrayPtr.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusiveArrayPtr.html#a3">~OsclExclusiveArrayPtr</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="classOsclExclusiveArrayPtr.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="classOsclExclusiveArrayPtr.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>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusiveArrayPtr.html#a6">get</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusiveArrayPtr.html#a6">get()</a> method returns the pointer, currently owned by the class.</em> <a href="#a6"></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="classOsclExclusiveArrayPtr.html#a7">release</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusiveArrayPtr.html#a7">release()</a> method releases ownership of the pointer, currently owned by the class. It returns the pointer as well.</em> <a href="#a7"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusiveArrayPtr.html#a8">set</a> (T *ptr)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusiveArrayPtr.html#a8">set()</a> method sets ownership to the pointer, passed. This method is needed when the class is created with a default constructor. Returns false in case the class is non-empty.</em> <a href="#a8"></a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusiveArrayPtr.html#n0">_Ptr</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;class T&gt;<br>
class OsclExclusiveArrayPtr&lt; T &gt;</h3>
The OsclExclusiveArrayPtr class is a template class that defines an array pointer like object intended to be assigned an address obtanined (directly or or indirectly) by new. When the OsclExclusiveArrayPtr 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 <a class="el" href="classOsclExclusivePtr.html">OsclExclusivePtr</a> 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 <a class="el" href="classOsclExclusivePtr.html">OsclExclusivePtr</a> 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="OsclExclusiveArrayPtr::OsclExclusiveArrayPtr"></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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> OsclExclusiveArrayPtr&lt; T &gt;::OsclExclusiveArrayPtr </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="OsclExclusiveArrayPtr::OsclExclusiveArrayPtr"></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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> OsclExclusiveArrayPtr&lt; T &gt;::OsclExclusiveArrayPtr </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">OsclExclusiveArrayPtr&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 OsclExclusiveArrayPtr. 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="OsclExclusiveArrayPtr::~OsclExclusiveArrayPtr"></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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> virtual OsclExclusiveArrayPtr&lt; T &gt;::~OsclExclusiveArrayPtr </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, virtual]</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="a6" doxytag="OsclExclusiveArrayPtr::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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> T* OsclExclusiveArrayPtr&lt; T &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="classOsclExclusiveArrayPtr.html#a6">get()</a> method returns the pointer, currently owned by the class.
<p>
</td>
</tr>
</table>
<a name="a4" doxytag="OsclExclusiveArrayPtr::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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> T&amp; OsclExclusiveArrayPtr&lt; T &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 OsclExclusiveArrayPtr can be used like the regular pointer that it was initialized with. </td>
</tr>
</table>
<a name="a5" doxytag="OsclExclusiveArrayPtr::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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> T* OsclExclusiveArrayPtr&lt; T &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 OsclExclusiveArrayPtr can be used like the regular pointer that it was initialized with. </td>
</tr>
</table>
<a name="a2" doxytag="OsclExclusiveArrayPtr::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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> OsclExclusiveArrayPtr&lt;T&gt;&amp; OsclExclusiveArrayPtr&lt; T &gt;::operator= </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">OsclExclusiveArrayPtr&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>
Assignment operator from an another OsclExclusiveArrayPtr.
<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 OsclExclusiveArrayPtr </td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
Returns a reference to this OsclExclusiveArrayPtr 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 OsclExclusiveArrayPtr given as the input parameter. The ownership of the pointer is transferred. </td>
</tr>
</table>
<a name="a7" doxytag="OsclExclusiveArrayPtr::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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> T* OsclExclusiveArrayPtr&lt; T &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><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="classOsclExclusiveArrayPtr.html#a7">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="OsclExclusiveArrayPtr::set"></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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> bool OsclExclusiveArrayPtr&lt; T &gt;::set </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>
<a class="el" href="classOsclExclusiveArrayPtr.html#a8">set()</a> method sets ownership to the pointer, passed. This method is needed when the class is created with a default constructor. Returns false in case the class is non-empty.
<p>
</td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a name="n0" doxytag="OsclExclusiveArrayPtr::_Ptr"></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&gt; </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> T* OsclExclusiveArrayPtr&lt; T &gt;::_Ptr<code> [protected]</code>
</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__exclusive__ptr_8h-source.html">oscl_exclusive_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>