• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3<title> TemplateOsclExclusivePtrA&lt; T, Alloc &gt; class Reference</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5</head><body>
6<!-- Generated by Doxygen 1.2.18 -->
7<center>
8<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>
9<hr><h1>OsclExclusivePtrA&lt; T, Alloc &gt; Class Template Reference<br>
10<small>
11[<a class="el" href="group__osclbase.html">OSCL Base</a>]</small>
12</h1>The OsclExclusivePtrA class is a template class that defines any pointer like object intended to be assigned an address obtanined (directly or or indirectly) through Alloc. When the OsclExclusivePtrA expires, Alloc is used to free the memory.
13<a href="#_details">More...</a>
14<p>
15<code>#include &lt;<a class="el" href="oscl__exclusive__ptr_8h-source.html">oscl_exclusive_ptr.h</a>&gt;</code>
16<p>
17<table border=0 cellpadding=0 cellspacing=0>
18<tr><td></td></tr>
19<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
20<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a0">OsclExclusivePtrA</a> (T *inPtr=0)</td></tr>
21<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>
22<tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a1">OsclExclusivePtrA</a> (OsclExclusivePtrA&lt; T, Alloc &gt; &amp;_Y)</td></tr>
23<tr><td>&nbsp;</td><td><font size=-1><em>Copy constructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
24<tr><td nowrap align=right valign=top>OsclExclusivePtrA&lt; T, Alloc &gt; &amp;&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a2">operator=</a> (OsclExclusivePtrA&lt; T, Alloc &gt; &amp;_Y)</td></tr>
25<tr><td>&nbsp;</td><td><font size=-1><em>Assignment operator from an another <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a>.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
26<tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a3">~OsclExclusivePtrA</a> ()</td></tr>
27<tr><td>&nbsp;</td><td><font size=-1><em>Destructor.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
28<tr><td nowrap align=right valign=top>T &amp;&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a4">operator *</a> () const</td></tr>
29<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>
30<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a5">operator-&gt;</a> () const</td></tr>
31<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>
32<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a6">get</a> () const</td></tr>
33<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusivePtrA.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>
34<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a7">release</a> ()</td></tr>
35<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusivePtrA.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>
36<tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#a8">set</a> (T *ptr)</td></tr>
37<tr><td>&nbsp;</td><td><font size=-1><em><a class="el" href="classOsclExclusivePtrA.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>
38<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
39<tr><td nowrap align=right valign=top>T *&nbsp;</td><td valign=bottom><a class="el" href="classOsclExclusivePtrA.html#n0">_Ptr</a></td></tr>
40</table>
41<hr><a name="_details"></a><h2>Detailed Description</h2>
42<h3>template&lt;class T, class Alloc&gt;<br>
43 class OsclExclusivePtrA&lt; T, Alloc &gt;</h3>
44
45The OsclExclusivePtrA class is a template class that defines any pointer like object intended to be assigned an address obtanined (directly or or indirectly) through Alloc. When the OsclExclusivePtrA expires, Alloc is used to free the memory.
46<p>
47The 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
48<p>
49<hr><h2>Constructor &amp; Destructor Documentation</h2>
50<a name="a0" doxytag="OsclExclusivePtrA::OsclExclusivePtrA"></a><p>
51<table width="100%" cellpadding="2" cellspacing="0" border="0">
52  <tr>
53    <td class="md">
54      <table cellpadding="0" cellspacing="0" border="0">
55        <tr>
56          <td class="md" colspan="4">
57template&lt;class T, class Alloc&gt; </td>
58        </tr>
59        <tr>
60          <td class="md" nowrap valign="top"> OsclExclusivePtrA&lt; T, Alloc &gt;::OsclExclusivePtrA </td>
61          <td class="md" valign="top">(&nbsp;</td>
62          <td class="md" nowrap valign="top">T *&nbsp;</td>
63          <td class="mdname1" valign="top" nowrap>&nbsp; <em>inPtr</em> = 0          </td>
64          <td class="md" valign="top">)&nbsp;</td>
65          <td class="md" nowrap><code> [inline, explicit]</code></td>
66        </tr>
67
68      </table>
69    </td>
70  </tr>
71</table>
72<table cellspacing=5 cellpadding=0 border=0>
73  <tr>
74    <td>
75      &nbsp;
76    </td>
77    <td>
78
79<p>
80Default constructor Initializes the pointer and takes ownership.
81<p>
82    </td>
83  </tr>
84</table>
85<a name="a1" doxytag="OsclExclusivePtrA::OsclExclusivePtrA"></a><p>
86<table width="100%" cellpadding="2" cellspacing="0" border="0">
87  <tr>
88    <td class="md">
89      <table cellpadding="0" cellspacing="0" border="0">
90        <tr>
91          <td class="md" colspan="4">
92template&lt;class T, class Alloc&gt; </td>
93        </tr>
94        <tr>
95          <td class="md" nowrap valign="top"> OsclExclusivePtrA&lt; T, Alloc &gt;::OsclExclusivePtrA </td>
96          <td class="md" valign="top">(&nbsp;</td>
97          <td class="md" nowrap valign="top">OsclExclusivePtrA&lt; T, Alloc &gt; &amp;&nbsp;</td>
98          <td class="mdname1" valign="top" nowrap>&nbsp; <em>_Y</em>          </td>
99          <td class="md" valign="top">)&nbsp;</td>
100          <td class="md" nowrap><code> [inline]</code></td>
101        </tr>
102
103      </table>
104    </td>
105  </tr>
106</table>
107<table cellspacing=5 cellpadding=0 border=0>
108  <tr>
109    <td>
110      &nbsp;
111    </td>
112    <td>
113
114<p>
115Copy constructor.
116<p>
117Initializes the pointer and takes ownership from another <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a>. Note that the other class does NOT own the pointer any longer, and hence it is NOT its responsibility to free it.     </td>
118  </tr>
119</table>
120<a name="a3" doxytag="OsclExclusivePtrA::~OsclExclusivePtrA"></a><p>
121<table width="100%" cellpadding="2" cellspacing="0" border="0">
122  <tr>
123    <td class="md">
124      <table cellpadding="0" cellspacing="0" border="0">
125        <tr>
126          <td class="md" colspan="4">
127template&lt;class T, class Alloc&gt; </td>
128        </tr>
129        <tr>
130          <td class="md" nowrap valign="top"> virtual OsclExclusivePtrA&lt; T, Alloc &gt;::~OsclExclusivePtrA </td>
131          <td class="md" valign="top">(&nbsp;</td>
132          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
133          <td class="md" valign="top">)&nbsp;</td>
134          <td class="md" nowrap><code> [inline, virtual]</code></td>
135        </tr>
136
137      </table>
138    </td>
139  </tr>
140</table>
141<table cellspacing=5 cellpadding=0 border=0>
142  <tr>
143    <td>
144      &nbsp;
145    </td>
146    <td>
147
148<p>
149Destructor.
150<p>
151The pointer is deleted in case this class still has ownership     </td>
152  </tr>
153</table>
154<hr><h2>Member Function Documentation</h2>
155<a name="a6" doxytag="OsclExclusivePtrA::get"></a><p>
156<table width="100%" cellpadding="2" cellspacing="0" border="0">
157  <tr>
158    <td class="md">
159      <table cellpadding="0" cellspacing="0" border="0">
160        <tr>
161          <td class="md" colspan="4">
162template&lt;class T, class Alloc&gt; </td>
163        </tr>
164        <tr>
165          <td class="md" nowrap valign="top"> T* OsclExclusivePtrA&lt; T, Alloc &gt;::get </td>
166          <td class="md" valign="top">(&nbsp;</td>
167          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
168          <td class="md" valign="top">)&nbsp;</td>
169          <td class="md" nowrap> const<code> [inline]</code></td>
170        </tr>
171
172      </table>
173    </td>
174  </tr>
175</table>
176<table cellspacing=5 cellpadding=0 border=0>
177  <tr>
178    <td>
179      &nbsp;
180    </td>
181    <td>
182
183<p>
184<a class="el" href="classOsclExclusivePtrA.html#a6">get()</a> method returns the pointer, currently owned by the class.
185<p>
186    </td>
187  </tr>
188</table>
189<a name="a4" doxytag="OsclExclusivePtrA::operator *"></a><p>
190<table width="100%" cellpadding="2" cellspacing="0" border="0">
191  <tr>
192    <td class="md">
193      <table cellpadding="0" cellspacing="0" border="0">
194        <tr>
195          <td class="md" colspan="4">
196template&lt;class T, class Alloc&gt; </td>
197        </tr>
198        <tr>
199          <td class="md" nowrap valign="top"> T&amp; OsclExclusivePtrA&lt; T, Alloc &gt;::operator * </td>
200          <td class="md" valign="top">(&nbsp;</td>
201          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
202          <td class="md" valign="top">)&nbsp;</td>
203          <td class="md" nowrap> const<code> [inline]</code></td>
204        </tr>
205
206      </table>
207    </td>
208  </tr>
209</table>
210<table cellspacing=5 cellpadding=0 border=0>
211  <tr>
212    <td>
213      &nbsp;
214    </td>
215    <td>
216
217<p>
218The indirection operator (*) accesses a value indirectly, through a pointer.
219<p>
220This operator ensures that the <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a> can be used like the regular pointer that it was initialized with.     </td>
221  </tr>
222</table>
223<a name="a5" doxytag="OsclExclusivePtrA::operator->"></a><p>
224<table width="100%" cellpadding="2" cellspacing="0" border="0">
225  <tr>
226    <td class="md">
227      <table cellpadding="0" cellspacing="0" border="0">
228        <tr>
229          <td class="md" colspan="4">
230template&lt;class T, class Alloc&gt; </td>
231        </tr>
232        <tr>
233          <td class="md" nowrap valign="top"> T* OsclExclusivePtrA&lt; T, Alloc &gt;::operator-&gt; </td>
234          <td class="md" valign="top">(&nbsp;</td>
235          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
236          <td class="md" valign="top">)&nbsp;</td>
237          <td class="md" nowrap> const<code> [inline]</code></td>
238        </tr>
239
240      </table>
241    </td>
242  </tr>
243</table>
244<table cellspacing=5 cellpadding=0 border=0>
245  <tr>
246    <td>
247      &nbsp;
248    </td>
249    <td>
250
251<p>
252The indirection operator (-&gt;) accesses a value indirectly, through a pointer.
253<p>
254This operator ensures that the <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a> can be used like the regular pointer that it was initialized with.     </td>
255  </tr>
256</table>
257<a name="a2" doxytag="OsclExclusivePtrA::operator="></a><p>
258<table width="100%" cellpadding="2" cellspacing="0" border="0">
259  <tr>
260    <td class="md">
261      <table cellpadding="0" cellspacing="0" border="0">
262        <tr>
263          <td class="md" colspan="4">
264template&lt;class T, class Alloc&gt; </td>
265        </tr>
266        <tr>
267          <td class="md" nowrap valign="top"> OsclExclusivePtrA&lt;T, Alloc&gt;&amp; OsclExclusivePtrA&lt; T, Alloc &gt;::operator= </td>
268          <td class="md" valign="top">(&nbsp;</td>
269          <td class="md" nowrap valign="top">OsclExclusivePtrA&lt; T, Alloc &gt; &amp;&nbsp;</td>
270          <td class="mdname1" valign="top" nowrap>&nbsp; <em>_Y</em>          </td>
271          <td class="md" valign="top">)&nbsp;</td>
272          <td class="md" nowrap><code> [inline]</code></td>
273        </tr>
274
275      </table>
276    </td>
277  </tr>
278</table>
279<table cellspacing=5 cellpadding=0 border=0>
280  <tr>
281    <td>
282      &nbsp;
283    </td>
284    <td>
285
286<p>
287Assignment operator from an another <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a>.
288<p>
289<dl compact><dt><b>Parameters: </b></dt><dd>
290<table border=0 cellspacing=2 cellpadding=0>
291<tr><td valign=top><em>_Y</em>&nbsp;</td><td>
292The value parameter should be another <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a> </td></tr>
293</table>
294</dl><dl compact><dt><b>Returns: </b></dt><dd>
295Returns a reference to this <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a> instance with pointer initialized. </dl><dl compact><dt><b>Precondition: </b></dt><dd>
296The 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 <a class="el" href="classOsclExclusiveArrayPtr.html">OsclExclusiveArrayPtr</a> given as the input parameter. The ownership of the pointer is transferred.     </td>
297  </tr>
298</table>
299<a name="a7" doxytag="OsclExclusivePtrA::release"></a><p>
300<table width="100%" cellpadding="2" cellspacing="0" border="0">
301  <tr>
302    <td class="md">
303      <table cellpadding="0" cellspacing="0" border="0">
304        <tr>
305          <td class="md" colspan="4">
306template&lt;class T, class Alloc&gt; </td>
307        </tr>
308        <tr>
309          <td class="md" nowrap valign="top"> T* OsclExclusivePtrA&lt; T, Alloc &gt;::release </td>
310          <td class="md" valign="top">(&nbsp;</td>
311          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
312          <td class="md" valign="top">)&nbsp;</td>
313          <td class="md" nowrap><code> [inline]</code></td>
314        </tr>
315
316      </table>
317    </td>
318  </tr>
319</table>
320<table cellspacing=5 cellpadding=0 border=0>
321  <tr>
322    <td>
323      &nbsp;
324    </td>
325    <td>
326
327<p>
328<a class="el" href="classOsclExclusivePtrA.html#a7">release()</a> method releases ownership of the pointer, currently owned by the class. It returns the pointer as well.
329<p>
330    </td>
331  </tr>
332</table>
333<a name="a8" doxytag="OsclExclusivePtrA::set"></a><p>
334<table width="100%" cellpadding="2" cellspacing="0" border="0">
335  <tr>
336    <td class="md">
337      <table cellpadding="0" cellspacing="0" border="0">
338        <tr>
339          <td class="md" colspan="4">
340template&lt;class T, class Alloc&gt; </td>
341        </tr>
342        <tr>
343          <td class="md" nowrap valign="top"> bool OsclExclusivePtrA&lt; T, Alloc &gt;::set </td>
344          <td class="md" valign="top">(&nbsp;</td>
345          <td class="md" nowrap valign="top">T *&nbsp;</td>
346          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ptr</em>          </td>
347          <td class="md" valign="top">)&nbsp;</td>
348          <td class="md" nowrap><code> [inline]</code></td>
349        </tr>
350
351      </table>
352    </td>
353  </tr>
354</table>
355<table cellspacing=5 cellpadding=0 border=0>
356  <tr>
357    <td>
358      &nbsp;
359    </td>
360    <td>
361
362<p>
363<a class="el" href="classOsclExclusivePtrA.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.
364<p>
365    </td>
366  </tr>
367</table>
368<hr><h2>Field Documentation</h2>
369<a name="n0" doxytag="OsclExclusivePtrA::_Ptr"></a><p>
370<table width="100%" cellpadding="2" cellspacing="0" border="0">
371  <tr>
372    <td class="md">
373      <table cellpadding="0" cellspacing="0" border="0">
374        <tr>
375          <td class="md" colspan="4">
376template&lt;class T, class Alloc&gt; </td>
377        </tr>
378        <tr>
379          <td class="md" nowrap valign="top"> T* OsclExclusivePtrA&lt; T, Alloc &gt;::_Ptr<code> [protected]</code>
380      </table>
381    </td>
382  </tr>
383</table>
384<table cellspacing=5 cellpadding=0 border=0>
385  <tr>
386    <td>
387      &nbsp;
388    </td>
389    <td>
390
391<p>
392    </td>
393  </tr>
394</table>
395<hr>The documentation for this class was generated from the following file:<ul>
396<li><a class="el" href="oscl__exclusive__ptr_8h-source.html">oscl_exclusive_ptr.h</a></ul>
397<hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
398<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
399</small></address>
400</body>
401</html>
402