diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a03321.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a03321.html')
-rw-r--r-- | docs/doxygen/nel/a03321.html | 720 |
1 files changed, 720 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03321.html b/docs/doxygen/nel/a03321.html new file mode 100644 index 00000000..c1074e7a --- /dev/null +++ b/docs/doxygen/nel/a03321.html @@ -0,0 +1,720 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: TemplateNLMISC::CRefPtr< T > class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CRefPtr< T > Class Template Reference</h1><code>#include <<a class="el" href="a06402.html">smart_ptr.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +<h3>template<class T><br> + class NLMISC::CRefPtr< T ></h3> + +<a class="el" href="a03321.html">CRefPtr</a>: an handle on a ptr. T Must derive from <a class="el" href="a02209.html">CRefCount</a>. If you use <a class="el" href="a03321.html">CRefPtr</a>, you can kill the object simply by calling delete (T*)RefPtr, or the <a class="el" href="a03321.html#NLMISC_1_1CRefPtra3">kill()</a> method. All other <a class="el" href="a03321.html">CRefPtr</a> which point to it can know if it has been deleted. (but you must be sure that this ptr is not handle by a SmartPtr, of course...)<p> +SmartPtr are compatible with RefPtr. A ptr may be link to a <a class="el" href="a03321.html">CRefPtr</a> and a <a class="el" href="a03408.html">CSmartPtr</a>. As example, when the <a class="el" href="a03408.html">CSmartPtr</a> will destroy him, <a class="el" href="a03321.html">CRefPtr</a> will be informed... Sample: <pre class="fragment"><div> <span class="keywordtype">void</span> foo() + { + A *p; + CSmartPtr<A> sp; + CRefPtr<A> rp; + + p= <span class="keyword">new</span> A; + sp= p; <span class="comment">// OK. p is now owned by sp and will be deleted by sp.</span> + rp= p; <span class="comment">// OK. rp handle p.</span> + sp= NULL; <span class="comment">// Destruction. p deleted. rp automatically informed.</span> + <span class="keywordflow">if</span>(rp==NULL) + thisIsGood(); <span class="comment">// rp==NULL.</span> + } +</div></pre><p> +<b>PERFORMANCE</b> <b>WARNING!</b> <a class="el" href="a03321.html#NLMISC_1_1CRefPtra8">operator=()</a> are about 10 times slower than normal pointers. So use them wisely. For local use, prefer cast the refptr to a normal Ptr. Also, an object used with a <a class="el" href="a03321.html">CRefPtr</a> will allocate a small PtrInfo (one only per object, not per ptr). <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a03408.html">CSmartPtr</a> </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06402.html#l00256">256</a> of file <a class="el" href="a06402.html">smart_ptr.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra0">CRefPtr</a> (const <a class="el" href="a03321.html">CRefPtr</a> &copy)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <a href="#NLMISC_1_1CRefPtra0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra1">CRefPtr</a> (T *<a class="el" href="a04223.html#a576">v</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Attach a ptr to a RefPtr. <a href="#NLMISC_1_1CRefPtra1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra2">CRefPtr</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Init a NULL Ptr. <a href="#NLMISC_1_1CRefPtra2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra3">kill</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>T & </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra4">operator *</a> (void) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Indirection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. <a href="#NLMISC_1_1CRefPtra4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra5">operator T *</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Cast operator. Check if the object has been deleted somewhere, and return NULL if this is the case. <a href="#NLMISC_1_1CRefPtra5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>T * </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra6">operator-></a> (void) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Selection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. <a href="#NLMISC_1_1CRefPtra6"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03321.html">CRefPtr</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra7">operator=</a> (const <a class="el" href="a03321.html">CRefPtr</a> &copy)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">operator=. Giving a NULL pointer is a valid operation. <a href="#NLMISC_1_1CRefPtra7"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03321.html">CRefPtr</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra8">operator=</a> (T *<a class="el" href="a04223.html#a576">v</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">operator=. Giving a NULL pointer is a valid operation. <a href="#NLMISC_1_1CRefPtra8"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtra9">~CRefPtr</a> (void)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Release the RefPtr. <a href="#NLMISC_1_1CRefPtra9"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a> () const </td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03320.html">CRefCount::CPtrInfo</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>T * </td><td class="memItemRight" valign=bottom><a class="el" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a></td></tr> + +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CRefPtra2" doxytag="NLMISC::CRefPtr::CRefPtr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::<a class="el" href="a03321.html">CRefPtr</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Init a NULL Ptr. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00153">153</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>. +<p> +<div class="fragment"><pre>00154 { +00155 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= &CRefCount::NullPtrInfo; +00156 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= NULL; +00157 +00158 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"Smart()"</span>); +00159 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra1" doxytag="NLMISC::CRefPtr::CRefPtr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::<a class="el" href="a03321.html">CRefPtr</a> </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">T * </td> + <td class="mdname1" valign="top" nowrap> <em>v</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Attach a ptr to a RefPtr. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00160">160</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>, <a class="el" href="a06402.html#l00056">NLMISC::CRefCount::CPtrInfo::RefCount</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +<div class="fragment"><pre>00161 { +00162 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= <a class="code" href="a04223.html#a576">v</a>; +00163 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a576">v</a>) +00164 { +00165 <span class="comment">// If no CRefPtr handles v, create a pinfo ref...</span> +00166 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a576">v</a>->pinfo->IsNullPtrInfo) +00167 <a class="code" href="a04223.html#a576">v</a>->pinfo=<span class="keyword">new</span> CRefCount::CPtrInfo(v); +00168 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>=<a class="code" href="a04223.html#a576">v</a>->pinfo; +00169 <span class="comment">// v is now used by this.</span> +00170 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->RefCount++; +00171 } +00172 <span class="keywordflow">else</span> +00173 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= &CRefCount::NullPtrInfo; +00174 +00175 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"Smart(T*)"</span>); +00176 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra0" doxytag="NLMISC::CRefPtr::CRefPtr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::<a class="el" href="a03321.html">CRefPtr</a> </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03321.html">CRefPtr</a>< T > & </td> + <td class="mdname1" valign="top" nowrap> <em>copy</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Copy constructor. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00177">177</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00259">NLMISC::CRefPtr< T >::pinfo</a>, <a class="el" href="a06402.html#l00055">NLMISC::CRefCount::CPtrInfo::Ptr</a>, <a class="el" href="a06402.html#l00097">REF_TRACE</a>, and <a class="el" href="a06402.html#l00056">NLMISC::CRefCount::CPtrInfo::RefCount</a>. +<p> +<div class="fragment"><pre>00178 { +00179 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>=copy.pinfo; +00180 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->RefCount++; +00181 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= (T*)<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr; +00182 +00183 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"SmartCopy()"</span>); +00184 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra9" doxytag="NLMISC::CRefPtr::~CRefPtr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::~<a class="el" href="a03321.html">CRefPtr</a> </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Release the RefPtr. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00185">185</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>, and <a class="el" href="a06403.html#l00121">NLMISC::CRefPtr< T >::unRef()</a>. +<p> +<div class="fragment"><pre>00186 { +00187 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"~Smart()"</span>); +00188 +00189 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a>(); +00190 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= &CRefCount::NullPtrInfo; +00191 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= NULL; +00192 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CRefPtra3" doxytag="NLMISC::CRefPtr::kill" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> void <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::kill </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +kill/delete the object pointed by the pointer, and inform the other RefPtr of this. "rp.kill()" and "delete (T*)rp" do the same thing, except that rp NULLity is updated with <a class="el" href="a03321.html#NLMISC_1_1CRefPtra3">kill()</a>. RefPtr which point to the same object could know if the object is valid, by just testing it ( by an implicit call to the cast operator to T*). But any calls to <a class="el" href="a03321.html#NLMISC_1_1CRefPtra6">operator->()</a> or <a class="el" href="a03321.html#NLMISC_1_1CRefPtra4">operator*()</a> will have unpredictible effects (may crash... :) ). +<p> +Definition at line <a class="el" href="a06403.html#l00241">241</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00055">NLMISC::CRefCount::CPtrInfo::Ptr</a>, <a class="el" href="a06402.html#l00097">REF_TRACE</a>, and <a class="el" href="a06403.html#l00121">NLMISC::CRefPtr< T >::unRef()</a>. +<p> +<div class="fragment"><pre>00242 { +00243 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"SmartKill"</span>); +00244 +00245 T *ptr= (T*)<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr; +00246 +00247 <span class="comment">// First, release the refptr.</span> +00248 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a>(); +00249 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= &CRefCount::NullPtrInfo; +00250 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= NULL; +00251 +00252 <span class="comment">// Then delete the pointer.</span> +00253 <span class="keywordflow">if</span>(ptr) +00254 <span class="keyword">delete</span> ptr; +00255 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra4" doxytag="NLMISC::CRefPtr::operator *" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> T & <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::operator * </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Indirection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00272">272</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>. +<p> +<div class="fragment"><pre>00273 { +00274 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"Smart *()"</span>); +00275 <span class="keywordflow">return</span> *<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>; +00276 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra5" doxytag="NLMISC::CRefPtr::operator T *" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::operator T * </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Cast operator. Check if the object has been deleted somewhere, and return NULL if this is the case. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00260">260</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00055">NLMISC::CRefCount::CPtrInfo::Ptr</a>, and <a class="el" href="a06402.html#l00097">REF_TRACE</a>. +<p> +<div class="fragment"><pre>00261 { +00262 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"SmartCast T*()"</span>); +00263 +00264 <span class="comment">// Refresh Ptr.</span> +00265 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= (T*)<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr; +00266 <span class="keywordflow">return</span> <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>; +00267 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra6" doxytag="NLMISC::CRefPtr::operator->" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> T * <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::operator-> </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Selection operator. Doesn't test if ptr has been deleted somewhere, and doesn't check NULL. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00277">277</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>. +<p> +<div class="fragment"><pre>00278 { +00279 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"Smart ->()"</span>); +00280 <span class="keywordflow">return</span> <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>; +00281 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra7" doxytag="NLMISC::CRefPtr::operator=" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">CRefPtr</a>< T > & <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::operator= </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03321.html">CRefPtr</a>< T > & </td> + <td class="mdname1" valign="top" nowrap> <em>copy</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +operator=. Giving a NULL pointer is a valid operation. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00223">223</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00259">NLMISC::CRefPtr< T >::pinfo</a>, <a class="el" href="a06402.html#l00055">NLMISC::CRefCount::CPtrInfo::Ptr</a>, <a class="el" href="a06402.html#l00097">REF_TRACE</a>, <a class="el" href="a06402.html#l00056">NLMISC::CRefCount::CPtrInfo::RefCount</a>, and <a class="el" href="a06403.html#l00121">NLMISC::CRefPtr< T >::unRef()</a>. +<p> +<div class="fragment"><pre>00224 { +00225 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"ope=(Smart)Start"</span>); +00226 +00227 <span class="comment">// The auto equality test is implicitly done by upcounting first "copy", then downcounting "this".</span> +00228 copy.pinfo->RefCount++; +00229 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a>(); +00230 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>=copy.pinfo; +00231 <span class="comment">// Must Refresh the ptr.</span> +00232 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= (T*)<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr; +00233 +00234 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"ope=(Smart)End"</span>); +00235 <span class="keywordflow">return</span> *<span class="keyword">this</span>; +00236 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtra8" doxytag="NLMISC::CRefPtr::operator=" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03321.html">CRefPtr</a>< T > & <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::operator= </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">T * </td> + <td class="mdname1" valign="top" nowrap> <em>v</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +operator=. Giving a NULL pointer is a valid operation. +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00196">196</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00097">REF_TRACE</a>, <a class="el" href="a06403.html#l00121">NLMISC::CRefPtr< T >::unRef()</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +<div class="fragment"><pre>00197 { +00198 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"ope=(T*)Start"</span>); +00199 +00200 +00201 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a>= <a class="code" href="a04223.html#a576">v</a>; +00202 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a576">v</a>) +00203 { +00204 <span class="comment">// If no CRefPtr handles v, create a pinfo ref...</span> +00205 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a576">v</a>->pinfo->IsNullPtrInfo) +00206 <a class="code" href="a04223.html#a576">v</a>->pinfo=<span class="keyword">new</span> CRefCount::CPtrInfo(v); +00207 <span class="comment">// The auto equality test is implicitly done by upcounting first "v", then downcounting "this".</span> +00208 <a class="code" href="a04223.html#a576">v</a>->pinfo->RefCount++; +00209 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a>(); +00210 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= <a class="code" href="a04223.html#a576">v</a>->pinfo; +00211 } +00212 <span class="keywordflow">else</span> +00213 { +00214 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrd0">unRef</a>(); +00215 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>= &CRefCount::NullPtrInfo; +00216 } +00217 +00218 +00219 <a class="code" href="a04979.html#a1">REF_TRACE</a>(<span class="stringliteral">"ope=(T*)End"</span>); +00220 +00221 <span class="keywordflow">return</span> *<span class="keyword">this</span>; +00222 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtrd0" doxytag="NLMISC::CRefPtr::unRef" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> void <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::unRef </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06403.html#l00121">121</a> of file <a class="el" href="a06403.html">smart_ptr_inline.h</a>. +<p> +References <a class="el" href="a06402.html#l00058">NLMISC::CRefCount::CPtrInfo::IsNullPtrInfo</a>, <a class="el" href="a06402.html#l00055">NLMISC::CRefCount::CPtrInfo::Ptr</a>, <a class="el" href="a06402.html#l00056">NLMISC::CRefCount::CPtrInfo::RefCount</a>, and <a class="el" href="a06403.html#l00039">SMART_INLINE</a>. +<p> +Referenced by <a class="el" href="a06403.html#l00241">NLMISC::CRefPtr< T >::kill()</a>, <a class="el" href="a06403.html#l00196">NLMISC::CRefPtr< T >::operator=()</a>, and <a class="el" href="a06403.html#l00185">NLMISC::CRefPtr< T >::~CRefPtr()</a>. +<p> +<div class="fragment"><pre>00122 { +00123 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->RefCount--; +00124 <span class="keywordflow">if</span>(<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->RefCount==0) +00125 { +00126 <span class="comment">// In CRefPtr, Never delete the object.</span> +00127 +00128 <span class="comment">// We may be in the case that this==NullPtrInfo, and our NullPtrInfo has done a total round. Test it.</span> +00129 <span class="keywordflow">if</span>(<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->IsNullPtrInfo) +00130 { +00131 <span class="comment">// This should not happens, but I'm not sure :) ...</span> +00132 <span class="comment">// Reset the NullPtrInfo to a middle round.</span> +00133 <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->RefCount= 0x7FFFFFFF; +00134 } +00135 <span class="keywordflow">else</span> +00136 { +00137 <span class="comment">// If the CRefPtr still point to a valid object.</span> +00138 <span class="keywordflow">if</span>(<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr) +00139 { +00140 <span class="comment">// Inform the Object that no more CRefPtr points on it.</span> +00141 ((T*)(<a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>->Ptr))->pinfo= &CRefCount::NullPtrInfo; +00142 } +00143 <span class="comment">// Then delete the pinfo.</span> +00144 <span class="keyword">delete</span> <a class="code" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a>; +00145 } +00146 +00147 } +00148 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CRefPtrr0" doxytag="NLMISC::CRefPtr::pinfo" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03320.html">CRefCount::CPtrInfo</a>* <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::<a class="el" href="a03321.html#NLMISC_1_1CRefPtrr0">pinfo</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06402.html#l00259">259</a> of file <a class="el" href="a06402.html">smart_ptr.h</a>. +<p> +Referenced by <a class="el" href="a06403.html#l00177">NLMISC::CRefPtr< T >::CRefPtr()</a>, and <a class="el" href="a06403.html#l00223">NLMISC::CRefPtr< T >::operator=()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CRefPtrr1" doxytag="NLMISC::CRefPtr::Ptr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> T* <a class="el" href="a03321.html">NLMISC::CRefPtr</a>< T >::<a class="el" href="a03321.html#NLMISC_1_1CRefPtrr1">Ptr</a><code> [mutable, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06402.html#l00260">260</a> of file <a class="el" href="a06402.html">smart_ptr.h</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06402.html">smart_ptr.h</a><li><a class="el" href="a06403.html">smart_ptr_inline.h</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:31:38 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |