Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-release > by-pkgid > 58828b263d8f56d90ac336dea07a4586 > files > 222

irrlicht-doc-1.6.1-1mdv2010.1.x86_64.rpm

<!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>Irrlicht Engine: IReferenceCounted.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table class="irrlicht" >
  <tr valign="middle"> 
    <td><font size="2"><a class="qindex" href="index.html"><font color="#FFFFFF">Home</font></a> 
      | <a class="qindex" href="namespaces.html"><font color="#FFFFFF">Namespaces</font></a> 
      | <a class="qindex" href="hierarchy.html"><font color="#FFFFFF">Hierarchy</font></a> 
      | <a class="qindex" href="classes.html"><font color="#FFFFFF">Alphabetical 
      List</font></a> | <a class="qindex" href="annotated.html"><font color="#FFFFFF"> 
      Class list</font></a> | <a class="qindex" href="files.html"><font color="#FFFFFF">Files</font></a> 
      | <a class="qindex" href="namespacemembers.html"><font color="#FFFFFF"> 
      Namespace&nbsp;Members</font></a> | <a class="qindex" href="functions.html"><font color="#FFFFFF">Class 
      members</font></a> | <a class="qindex" href="globals.html"><font color="#FFFFFF">File 
      members</font></a> | <a class="qindex" href="pages.html"><font color="#FFFFFF">Tutorials</font></a></font> </td>
  </tr>
</table>
<!-- Generated by Doxygen 1.5.6 -->
<h1>IReferenceCounted.h</h1><a href="_i_reference_counted_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2002-2009 Nikolaus Gebhardt</span>
<a name="l00002"></a>00002 <span class="comment">// This file is part of the "Irrlicht Engine".</span>
<a name="l00003"></a>00003 <span class="comment">// For conditions of distribution and use, see copyright notice in irrlicht.h</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="preprocessor">#ifndef __I_IREFERENCE_COUNTED_H_INCLUDED__</span>
<a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define __I_IREFERENCE_COUNTED_H_INCLUDED__</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span>
<a name="l00008"></a>00008 <span class="preprocessor">#include "<a class="code" href="irr_types_8h.html">irrTypes.h</a>"</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="keyword">namespace </span>irr
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 
<a name="l00014"></a>00014 
<a name="l00041"></a><a class="code" href="classirr_1_1_i_reference_counted.html">00041</a>         <span class="keyword">class </span><a class="code" href="classirr_1_1_i_reference_counted.html" title="Base class of most objects of the Irrlicht Engine.">IReferenceCounted</a>
<a name="l00042"></a>00042         {
<a name="l00043"></a>00043         <span class="keyword">public</span>:
<a name="l00044"></a>00044 
<a name="l00046"></a><a class="code" href="classirr_1_1_i_reference_counted.html#8411682018e68a2752d4c82675c71040">00046</a>                 <a class="code" href="classirr_1_1_i_reference_counted.html#8411682018e68a2752d4c82675c71040" title="Constructor.">IReferenceCounted</a>()
<a name="l00047"></a>00047                         : DebugName(0), ReferenceCounter(1)
<a name="l00048"></a>00048                 {
<a name="l00049"></a>00049                 }
<a name="l00050"></a>00050 
<a name="l00052"></a><a class="code" href="classirr_1_1_i_reference_counted.html#78abc75801cbb13d9db0955b3c07251c">00052</a>                 <span class="keyword">virtual</span> <a class="code" href="classirr_1_1_i_reference_counted.html#78abc75801cbb13d9db0955b3c07251c" title="Destructor.">~IReferenceCounted</a>()
<a name="l00053"></a>00053                 {
<a name="l00054"></a>00054                 }
<a name="l00055"></a>00055 
<a name="l00057"></a>00057 
<a name="l00086"></a><a class="code" href="classirr_1_1_i_reference_counted.html#2b7a035532e5f409ca9482dab79185f4">00086</a>                 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1_i_reference_counted.html#2b7a035532e5f409ca9482dab79185f4" title="Grabs the object. Increments the reference counter by one.">grab</a>()<span class="keyword"> const </span>{ ++ReferenceCounter; }
<a name="l00087"></a>00087 
<a name="l00089"></a>00089 
<a name="l00116"></a><a class="code" href="classirr_1_1_i_reference_counted.html#fb169a857e0d2cdb96b8821cb9bff17a">00116</a>                 <span class="keywordtype">bool</span> <a class="code" href="classirr_1_1_i_reference_counted.html#fb169a857e0d2cdb96b8821cb9bff17a" title="Drops the object. Decrements the reference counter by one.">drop</a>()<span class="keyword"> const</span>
<a name="l00117"></a>00117 <span class="keyword">                </span>{
<a name="l00118"></a>00118                         <span class="comment">// someone is doing bad reference counting.</span>
<a name="l00119"></a>00119                         <a class="code" href="irr_types_8h.html#12f3b5fd18ca108f90c5c74db602267e" title="define a break macro for debugging.">_IRR_DEBUG_BREAK_IF</a>(ReferenceCounter &lt;= 0)
<a name="l00120"></a>00120 
<a name="l00121"></a>00121                         --ReferenceCounter;
<a name="l00122"></a>00122                         <span class="keywordflow">if</span> (!ReferenceCounter)
<a name="l00123"></a>00123                         {
<a name="l00124"></a>00124                                 <span class="keyword">delete</span> <span class="keyword">this</span>;
<a name="l00125"></a>00125                                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00126"></a>00126                         }
<a name="l00127"></a>00127 
<a name="l00128"></a>00128                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00129"></a>00129                 }
<a name="l00130"></a>00130 
<a name="l00132"></a>00132 
<a name="l00133"></a><a class="code" href="classirr_1_1_i_reference_counted.html#198560456588db46331f06eda909a399">00133</a>                 <a class="code" href="namespaceirr.html#c66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> <a class="code" href="classirr_1_1_i_reference_counted.html#198560456588db46331f06eda909a399" title="Get the reference count.">getReferenceCount</a>()<span class="keyword"> const</span>
<a name="l00134"></a>00134 <span class="keyword">                </span>{
<a name="l00135"></a>00135                         <span class="keywordflow">return</span> ReferenceCounter;
<a name="l00136"></a>00136                 }
<a name="l00137"></a>00137 
<a name="l00139"></a>00139 
<a name="l00142"></a><a class="code" href="classirr_1_1_i_reference_counted.html#768e697e55d496e396b3acc5003d2bea">00142</a>                 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a>* <a class="code" href="classirr_1_1_i_reference_counted.html#768e697e55d496e396b3acc5003d2bea" title="Returns the debug name of the object.">getDebugName</a>()<span class="keyword"> const</span>
<a name="l00143"></a>00143 <span class="keyword">                </span>{
<a name="l00144"></a>00144                         <span class="keywordflow">return</span> DebugName;
<a name="l00145"></a>00145                 }
<a name="l00146"></a>00146 
<a name="l00147"></a>00147         <span class="keyword">protected</span>:
<a name="l00148"></a>00148 
<a name="l00150"></a>00150 
<a name="l00153"></a><a class="code" href="classirr_1_1_i_reference_counted.html#704c5042d399fe8cd3bdd65a0559002a">00153</a>                 <span class="keywordtype">void</span> <a class="code" href="classirr_1_1_i_reference_counted.html#704c5042d399fe8cd3bdd65a0559002a" title="Sets the debug name of the object.">setDebugName</a>(<span class="keyword">const</span> <a class="code" href="namespaceirr.html#9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a>* newName)
<a name="l00154"></a>00154                 {
<a name="l00155"></a>00155                         DebugName = newName;
<a name="l00156"></a>00156                 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158         <span class="keyword">private</span>:
<a name="l00159"></a>00159 
<a name="l00161"></a>00161                 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a>* DebugName;
<a name="l00162"></a>00162 
<a name="l00164"></a>00164                 <span class="keyword">mutable</span> <a class="code" href="namespaceirr.html#c66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> ReferenceCounter;
<a name="l00165"></a>00165         };
<a name="l00166"></a>00166 
<a name="l00167"></a>00167 } <span class="comment">// end namespace irr</span>
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <span class="preprocessor">#endif</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1">
<address style="align: right;">
<small> </small>
</address>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr> 
    <td width="0"> <div align="left"><small><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="irrlicht.png" alt="The Irrlicht Engine" align="middle" border=0 width=88 height=31></a></small></div></td>
    <td> <div align="left"><small><em><font size="2">The <a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht 
        Engine</a> Documentation &copy; 2003-2009 by Nikolaus Gebhardt. Generated 
        on Sun Jan 10 09:24:04 2010 by <a href="http://www.doxygen.org" target="_blank">Doxygen</a> 
        (1.5.6)</font></em></small></div></td>
  </tr>
</table>
<address style="align: right;">
</address>
</body>
</html>