Index: library/doc/html/shared__ptr_8h-source.html
===================================================================
--- library/doc/html/shared__ptr_8h-source.html (revision 538)
+++ library/doc/html/shared__ptr_8h-source.html (revision 590)
@@ -70,11 +70,11 @@
 <a name="l00018"></a>00018 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
 <a name="l00019"></a>00019 <span class="preprocessor">#include &lt;string&gt;</span>
-<a name="l00020"></a>00020 <span class="preprocessor">#include "itpp_ext.h"</span>
+<a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="bdmerror_8h.html" title="BDM&amp;#39;s exception-throwing macros.">bdmerror.h</a>"</span>
 <a name="l00021"></a>00021 
 <a name="l00022"></a>00022 <span class="keyword">namespace </span>bdm {
 <a name="l00023"></a>00023 
 <a name="l00033"></a>00033 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
-<a name="l00034"></a><a class="code" href="classbdm_1_1shared__ptr.html">00034</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a> {
-<a name="l00035"></a>00035         <span class="keyword">template</span>&lt;<span class="keyword">class</span> U&gt; <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>;
+<a name="l00034"></a><a class="code" href="classbdm_1_1shared__ptr.html">00034</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a> {
+<a name="l00035"></a>00035         <span class="keyword">template</span>&lt;<span class="keyword">class</span> U&gt; <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a>;
 <a name="l00036"></a>00036 
 <a name="l00037"></a>00037 <span class="keyword">private</span>:
@@ -83,152 +83,161 @@
 <a name="l00040"></a>00040 
 <a name="l00041"></a>00041 <span class="keyword">public</span>:
-<a name="l00043"></a><a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11">00043</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Creates an empty shared_ptr - one that doesn&amp;#39;t point anywhere.">shared_ptr</a>() :
-<a name="l00044"></a>00044                         payload ( 0 ),
-<a name="l00045"></a>00045                         refCnt ( 0 ) {
-<a name="l00046"></a>00046         }
-<a name="l00047"></a>00047 
-<a name="l00054"></a><a class="code" href="classbdm_1_1shared__ptr.html#c8b7f0a813173581530c80d7ac4fc7c2">00054</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Creates an empty shared_ptr - one that doesn&amp;#39;t point anywhere.">shared_ptr</a> ( T *p ) :
-<a name="l00055"></a>00055                         payload ( p ),
-<a name="l00056"></a>00056                         refCnt ( p ? new unsigned ( 1 ) : 0 ) {
-<a name="l00057"></a>00057         }
-<a name="l00058"></a>00058 
-<a name="l00061"></a><a class="code" href="classbdm_1_1shared__ptr.html#357702d12bfd608a08b46e4a194aa4b5">00061</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Creates an empty shared_ptr - one that doesn&amp;#39;t point anywhere.">shared_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;other ) :
-<a name="l00062"></a>00062                         payload ( other.payload ),
-<a name="l00063"></a>00063                         refCnt ( other.refCnt ) {
-<a name="l00064"></a>00064                 add_ref();
-<a name="l00065"></a>00065         }
-<a name="l00066"></a>00066 
-<a name="l00069"></a>00069         <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;
-<a name="l00070"></a><a class="code" href="classbdm_1_1shared__ptr.html#affa5b17385493f4102c52cf75d3b509">00070</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Creates an empty shared_ptr - one that doesn&amp;#39;t point anywhere.">shared_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr&lt;U&gt;</a> &amp;other ) :
-<a name="l00071"></a>00071                         payload ( other.payload ),
-<a name="l00072"></a>00072                         refCnt ( other.refCnt ) {
-<a name="l00073"></a>00073                 add_ref();
-<a name="l00074"></a>00074         }
-<a name="l00075"></a>00075 
-<a name="l00076"></a>00076         ~<a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>() {
-<a name="l00077"></a>00077                 del_ref();
-<a name="l00078"></a>00078         }
-<a name="l00079"></a>00079 
-<a name="l00080"></a>00080         shared_ptr&lt;T&gt; &amp;operator= ( <span class="keyword">const</span> shared_ptr&lt;T&gt; &amp;other ) {
-<a name="l00081"></a>00081                 other.add_ref();
-<a name="l00082"></a>00082                 del_ref();
-<a name="l00083"></a>00083 
-<a name="l00084"></a>00084                 payload = other.payload;
-<a name="l00085"></a>00085                 refCnt = other.refCnt;
-<a name="l00086"></a>00086 
-<a name="l00087"></a>00087                 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
-<a name="l00088"></a>00088         }
-<a name="l00089"></a>00089 
-<a name="l00092"></a><a class="code" href="classbdm_1_1shared__ptr.html#37ebcfb6750dd7b5630f1d2354c07a96">00092</a>         T *<span class="keyword">get</span>() {
-<a name="l00093"></a>00093                 <span class="keywordflow">return</span> payload;
-<a name="l00094"></a>00094         }
-<a name="l00095"></a>00095 
-<a name="l00099"></a><a class="code" href="classbdm_1_1shared__ptr.html#bcaae812868eacbad050beda465d2327">00099</a>         T *<a class="code" href="classbdm_1_1shared__ptr.html#bcaae812868eacbad050beda465d2327">operator-&gt;</a>() {
-<a name="l00100"></a>00100                 it_assert_debug ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
-<a name="l00101"></a>00101                 <span class="keywordflow">return</span> payload;
-<a name="l00102"></a>00102         }
-<a name="l00103"></a>00103 
-<a name="l00107"></a><a class="code" href="classbdm_1_1shared__ptr.html#de38de837267becf5eed2839fea42c45">00107</a>         T &amp;<a class="code" href="classbdm_1_1shared__ptr.html#de38de837267becf5eed2839fea42c45">operator*</a>() {
-<a name="l00108"></a>00108                 it_assert_debug ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
-<a name="l00109"></a>00109                 <span class="keywordflow">return</span> *payload;
-<a name="l00110"></a>00110         }
-<a name="l00111"></a>00111 
-<a name="l00114"></a><a class="code" href="classbdm_1_1shared__ptr.html#fff45e4841b2921cd42ce0691f8c1196">00114</a>         <span class="keyword">const</span> T* <span class="keyword">get</span>() <span class="keyword">const</span> {
-<a name="l00115"></a>00115                 <span class="keywordflow">return</span> payload;
-<a name="l00116"></a>00116         }
-<a name="l00117"></a>00117 
-<a name="l00121"></a><a class="code" href="classbdm_1_1shared__ptr.html#d89ec7ceb318241d833c7d278444396d">00121</a>         <span class="keyword">const</span> T *<a class="code" href="classbdm_1_1shared__ptr.html#d89ec7ceb318241d833c7d278444396d">operator-&gt;</a>()<span class="keyword"> const </span>{
-<a name="l00122"></a>00122                 it_assert_debug ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
-<a name="l00123"></a>00123                 <span class="keywordflow">return</span> payload;
-<a name="l00124"></a>00124         }
-<a name="l00125"></a>00125 
-<a name="l00129"></a><a class="code" href="classbdm_1_1shared__ptr.html#de000a72fe73804aa26962432f264800">00129</a>         <span class="keyword">const</span> T &amp;<a class="code" href="classbdm_1_1shared__ptr.html#de000a72fe73804aa26962432f264800">operator*</a>()<span class="keyword"> const </span>{
-<a name="l00130"></a>00130                 it_assert_debug ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
-<a name="l00131"></a>00131                 <span class="keywordflow">return</span> *payload;
-<a name="l00132"></a>00132         }
-<a name="l00133"></a>00133 
-<a name="l00134"></a>00134         <span class="keywordtype">bool</span> unique()<span class="keyword"> const </span>{
-<a name="l00135"></a>00135                 <span class="keywordflow">return</span> refCnt &amp;&amp; ( *refCnt == 1 );
-<a name="l00136"></a>00136         }
-<a name="l00137"></a>00137 
-<a name="l00138"></a>00138         <span class="keywordtype">long</span> use_count()<span class="keyword"> const </span>{
-<a name="l00139"></a>00139                 <span class="keywordflow">return</span> refCnt ? *refCnt : 0;
-<a name="l00140"></a>00140         }
-<a name="l00141"></a>00141 
-<a name="l00142"></a>00142         operator bool()<span class="keyword"> const </span>{
-<a name="l00143"></a>00143                 <span class="keywordflow">return</span> payload;
-<a name="l00144"></a>00144         }
-<a name="l00145"></a>00145 
-<a name="l00146"></a>00146         <span class="keywordtype">void</span> swap ( <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Creates an empty shared_ptr - one that doesn&amp;#39;t point anywhere.">shared_ptr</a> &amp;other ) {
-<a name="l00147"></a>00147                 std::swap ( payload, other.payload );
-<a name="l00148"></a>00148                 std::swap ( refCnt, other.refCnt );
-<a name="l00149"></a>00149         }
-<a name="l00150"></a>00150 
-<a name="l00151"></a>00151 <span class="keyword">private</span>:
-<a name="l00152"></a>00152         <span class="keywordtype">void</span> add_ref()<span class="keyword"> const </span>{
-<a name="l00153"></a>00153                 <span class="keywordflow">if</span> ( refCnt ) {
-<a name="l00154"></a>00154                         <span class="keywordflow">if</span> ( *refCnt == UINT_MAX ) {
-<a name="l00155"></a>00155                                 <span class="keywordflow">throw</span> std::overflow_error (
-<a name="l00156"></a>00156                                     std::string ( <span class="stringliteral">"Shared pointer has too many references."</span> ) );
-<a name="l00157"></a>00157                         }
-<a name="l00158"></a>00158 
-<a name="l00159"></a>00159                         ++*refCnt;
-<a name="l00160"></a>00160                 }
-<a name="l00161"></a>00161         }
-<a name="l00162"></a>00162 
-<a name="l00163"></a>00163         <span class="keywordtype">void</span> del_ref() {
-<a name="l00164"></a>00164                 <span class="keywordflow">if</span> ( refCnt ) {
-<a name="l00165"></a>00165                         <span class="keywordflow">if</span> ( ! ( --*refCnt ) ) {
-<a name="l00166"></a>00166                                 <span class="keyword">delete</span> payload;
-<a name="l00167"></a>00167                                 <span class="keyword">delete</span> refCnt;
-<a name="l00168"></a>00168                         }
-<a name="l00169"></a>00169                 }
-<a name="l00170"></a>00170         }
-<a name="l00171"></a>00171 };
-<a name="l00172"></a>00172 
-<a name="l00174"></a>00174 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
-<a name="l00175"></a>00175 <span class="keywordtype">bool</span> operator== ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
-<a name="l00176"></a>00176         <span class="keywordflow">return</span> a.get() == b.get();
-<a name="l00177"></a>00177 }
-<a name="l00178"></a>00178 
-<a name="l00180"></a>00180 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
-<a name="l00181"></a>00181 <span class="keywordtype">bool</span> operator!= ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
-<a name="l00182"></a>00182         <span class="keywordflow">return</span> a.get() != b.get();
-<a name="l00183"></a>00183 }
-<a name="l00184"></a>00184 
-<a name="l00186"></a>00186 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
-<a name="l00187"></a>00187 <span class="keywordtype">bool</span> operator&lt; ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
-<a name="l00188"></a>00188         <span class="keywordflow">return</span> a.get() &lt; b.get();
-<a name="l00189"></a>00189 }
-<a name="l00190"></a>00190 
-<a name="l00198"></a>00198 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
-<a name="l00199"></a><a class="code" href="classbdm_1_1object__ptr.html">00199</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>&lt;T&gt;
-<a name="l00200"></a>00200 {
-<a name="l00201"></a>00201 <span class="keyword">public</span>:
-<a name="l00207"></a><a class="code" href="classbdm_1_1object__ptr.html#9f1016ff2bbfa497d1cc0a4497c1fba4">00207</a>         <a class="code" href="classbdm_1_1object__ptr.html#9f1016ff2bbfa497d1cc0a4497c1fba4" title="Default constructor.">object_ptr</a>() : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( new T() ) { }
-<a name="l00208"></a>00208 
-<a name="l00214"></a><a class="code" href="classbdm_1_1object__ptr.html#dcb20017177c98274c16087b2c0067dc">00214</a>         <a class="code" href="classbdm_1_1object__ptr.html#dcb20017177c98274c16087b2c0067dc" title="Upcast from shared_ptr&amp;lt;T&amp;gt; to object_ptr&amp;lt;T&amp;gt;.">object_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;b ) : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( b ) {
-<a name="l00215"></a>00215                 it_assert_debug ( this-&gt;<span class="keyword">get</span>(), <span class="stringliteral">"object_ptr cannot be empty"</span> );
-<a name="l00216"></a>00216         }
-<a name="l00217"></a>00217 
-<a name="l00222"></a><a class="code" href="classbdm_1_1object__ptr.html#a9eb00600d8640711eadeed98c7892e9">00222</a>         <a class="code" href="classbdm_1_1object__ptr.html#a9eb00600d8640711eadeed98c7892e9">object_ptr</a> ( T *p ) : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( p ) {
-<a name="l00223"></a>00223                 it_assert_debug ( p, <span class="stringliteral">"object_ptr cannot be empty"</span> );
-<a name="l00224"></a>00224         }
-<a name="l00225"></a>00225 
-<a name="l00226"></a>00226         <a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr&lt;T&gt;</a> &amp;operator= ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr&lt;T&gt;</a> &amp;other ) {
-<a name="l00227"></a>00227                 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1:shared_ptr spec.">shared_ptr&lt;T&gt;::operator= </a>( other );
-<a name="l00228"></a>00228                 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
-<a name="l00229"></a>00229         }
-<a name="l00230"></a>00230 };
-<a name="l00231"></a>00231 
-<a name="l00232"></a>00232 <span class="preprocessor">#define SHAREDPTR(class_name) typedef bdm::object_ptr&lt; class_name &gt; class_name##_ptr</span>
-<a name="l00233"></a>00233 <span class="preprocessor"></span>
-<a name="l00234"></a>00234 <span class="preprocessor">#define SHAREDPTR2(template_class_name, template_parameter_name) typedef bdm::object_ptr&lt; template_class_name &lt; template_parameter_name &gt; &gt; template_class_name##_##template_parameter_name##_ptr</span>
-<a name="l00235"></a>00235 <span class="preprocessor"></span>
-<a name="l00236"></a>00236 }
-<a name="l00237"></a>00237 
-<a name="l00238"></a>00238 <span class="preprocessor">#endif</span>
+<a name="l00047"></a><a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11">00047</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Default constructor.">shared_ptr</a>() :
+<a name="l00048"></a>00048                         payload ( 0 ),
+<a name="l00049"></a>00049                         refCnt ( 0 ) {
+<a name="l00050"></a>00050         }
+<a name="l00051"></a>00051 
+<a name="l00058"></a><a class="code" href="classbdm_1_1shared__ptr.html#c8b7f0a813173581530c80d7ac4fc7c2">00058</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Default constructor.">shared_ptr</a> ( T *p ) :
+<a name="l00059"></a>00059                         payload ( p ),
+<a name="l00060"></a>00060                         refCnt ( p ? new unsigned ( 1 ) : 0 ) {
+<a name="l00061"></a>00061         }
+<a name="l00062"></a>00062 
+<a name="l00069"></a><a class="code" href="classbdm_1_1shared__ptr.html#357702d12bfd608a08b46e4a194aa4b5">00069</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Default constructor.">shared_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;other ) :
+<a name="l00070"></a>00070                         payload ( other.payload ),
+<a name="l00071"></a>00071                         refCnt ( other.refCnt ) {
+<a name="l00072"></a>00072                 add_ref();
+<a name="l00073"></a>00073         }
+<a name="l00074"></a>00074 
+<a name="l00084"></a>00084         <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;
+<a name="l00085"></a><a class="code" href="classbdm_1_1shared__ptr.html#affa5b17385493f4102c52cf75d3b509">00085</a>         <a class="code" href="classbdm_1_1shared__ptr.html#66a4d41031e37618f1a9bb3c81814c11" title="Default constructor.">shared_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr&lt;U&gt;</a> &amp;other ) :
+<a name="l00086"></a>00086                         payload ( other.payload ),
+<a name="l00087"></a>00087                         refCnt ( other.refCnt ) {
+<a name="l00088"></a>00088                 add_ref();
+<a name="l00089"></a>00089         }
+<a name="l00090"></a>00090 
+<a name="l00094"></a><a class="code" href="classbdm_1_1shared__ptr.html#79374842e417d2f64e449e374be4cfc1">00094</a>         <a class="code" href="classbdm_1_1shared__ptr.html#79374842e417d2f64e449e374be4cfc1">~shared_ptr</a>() {
+<a name="l00095"></a>00095                 del_ref();
+<a name="l00096"></a>00096         }
+<a name="l00097"></a>00097 
+<a name="l00101"></a><a class="code" href="classbdm_1_1shared__ptr.html#55263b1c8efbd3f8fddf703e2c457f6c">00101</a>         <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;<a class="code" href="classbdm_1_1shared__ptr.html#55263b1c8efbd3f8fddf703e2c457f6c" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;other ) {
+<a name="l00102"></a>00102                 other.<a class="code" href="classbdm_1_1shared__ptr.html#34e7b9cd7c05d80e2775279432d26e91">add_ref</a>();
+<a name="l00103"></a>00103                 del_ref();
+<a name="l00104"></a>00104 
+<a name="l00105"></a>00105                 payload = other.<a class="code" href="classbdm_1_1shared__ptr.html#7069b0472e45169e4c6b1c48bef8fcfb">payload</a>;
+<a name="l00106"></a>00106                 refCnt = other.<a class="code" href="classbdm_1_1shared__ptr.html#a061592b1c666f418c71626d2607f554">refCnt</a>;
+<a name="l00107"></a>00107 
+<a name="l00108"></a>00108                 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
+<a name="l00109"></a>00109         }
+<a name="l00110"></a>00110 
+<a name="l00115"></a><a class="code" href="classbdm_1_1shared__ptr.html#37ebcfb6750dd7b5630f1d2354c07a96">00115</a>         T *<span class="keyword">get</span>() {
+<a name="l00116"></a>00116                 <span class="keywordflow">return</span> payload;
+<a name="l00117"></a>00117         }
+<a name="l00118"></a>00118 
+<a name="l00124"></a><a class="code" href="classbdm_1_1shared__ptr.html#bcaae812868eacbad050beda465d2327">00124</a>         T *<a class="code" href="classbdm_1_1shared__ptr.html#bcaae812868eacbad050beda465d2327">operator-&gt;</a>() {
+<a name="l00125"></a>00125                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
+<a name="l00126"></a>00126                 <span class="keywordflow">return</span> payload;
+<a name="l00127"></a>00127         }
+<a name="l00128"></a>00128 
+<a name="l00132"></a><a class="code" href="classbdm_1_1shared__ptr.html#de38de837267becf5eed2839fea42c45">00132</a>         T &amp;<a class="code" href="classbdm_1_1shared__ptr.html#de38de837267becf5eed2839fea42c45">operator*</a>() {
+<a name="l00133"></a>00133                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
+<a name="l00134"></a>00134                 <span class="keywordflow">return</span> *payload;
+<a name="l00135"></a>00135         }
+<a name="l00136"></a>00136 
+<a name="l00141"></a><a class="code" href="classbdm_1_1shared__ptr.html#fff45e4841b2921cd42ce0691f8c1196">00141</a>         <span class="keyword">const</span> T* <span class="keyword">get</span>() <span class="keyword">const</span> {
+<a name="l00142"></a>00142                 <span class="keywordflow">return</span> payload;
+<a name="l00143"></a>00143         }
+<a name="l00144"></a>00144 
+<a name="l00148"></a><a class="code" href="classbdm_1_1shared__ptr.html#d89ec7ceb318241d833c7d278444396d">00148</a>         <span class="keyword">const</span> T *<a class="code" href="classbdm_1_1shared__ptr.html#d89ec7ceb318241d833c7d278444396d">operator-&gt;</a>()<span class="keyword"> const </span>{
+<a name="l00149"></a>00149                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
+<a name="l00150"></a>00150                 <span class="keywordflow">return</span> payload;
+<a name="l00151"></a>00151         }
+<a name="l00152"></a>00152 
+<a name="l00156"></a><a class="code" href="classbdm_1_1shared__ptr.html#de000a72fe73804aa26962432f264800">00156</a>         <span class="keyword">const</span> T &amp;<a class="code" href="classbdm_1_1shared__ptr.html#de000a72fe73804aa26962432f264800">operator*</a>()<span class="keyword"> const </span>{
+<a name="l00157"></a>00157                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( payload, <span class="stringliteral">"dereferencing NULL"</span> );
+<a name="l00158"></a>00158                 <span class="keywordflow">return</span> *payload;
+<a name="l00159"></a>00159         }
+<a name="l00160"></a>00160 
+<a name="l00162"></a><a class="code" href="classbdm_1_1shared__ptr.html#338dbc6aa9fd95175abdc2df3ae2c284">00162</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1shared__ptr.html#338dbc6aa9fd95175abdc2df3ae2c284" title="Returns use_count() == 1.">unique</a>()<span class="keyword"> const </span>{
+<a name="l00163"></a>00163                 <span class="keywordflow">return</span> refCnt &amp;&amp; ( *refCnt == 1 );
+<a name="l00164"></a>00164         }
+<a name="l00165"></a>00165 
+<a name="l00171"></a><a class="code" href="classbdm_1_1shared__ptr.html#8e52b8887a4408c52b5263a5717343f2">00171</a>         <span class="keywordtype">long</span> <a class="code" href="classbdm_1_1shared__ptr.html#8e52b8887a4408c52b5263a5717343f2">use_count</a>()<span class="keyword"> const </span>{
+<a name="l00172"></a>00172                 <span class="keywordflow">return</span> refCnt ? *refCnt : 0;
+<a name="l00173"></a>00173         }
+<a name="l00174"></a>00174 
+<a name="l00180"></a><a class="code" href="classbdm_1_1shared__ptr.html#6cac71bb600f9f7c6fbed9335fd22d37">00180</a>         <a class="code" href="classbdm_1_1shared__ptr.html#6cac71bb600f9f7c6fbed9335fd22d37" title="Boolean cast.">operator bool</a>()<span class="keyword"> const </span>{
+<a name="l00181"></a>00181                 <span class="keywordflow">return</span> !!payload;
+<a name="l00182"></a>00182         }
+<a name="l00183"></a>00183 
+<a name="l00190"></a>00190         <span class="keyword">template</span>&lt;<span class="keyword">typename</span> U&gt;
+<a name="l00191"></a><a class="code" href="classbdm_1_1shared__ptr.html#b3cd369b00369ab92456aa0645e8d560">00191</a>         <a class="code" href="classbdm_1_1shared__ptr.html#b3cd369b00369ab92456aa0645e8d560" title="const cast">operator shared_ptr&lt;const U&gt;</a>()<span class="keyword"> const </span>{
+<a name="l00192"></a>00192                 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr&lt;const U&gt;</a> cptr;               
+<a name="l00193"></a>00193                 cptr.<a class="code" href="classbdm_1_1shared__ptr.html#a061592b1c666f418c71626d2607f554">refCnt</a> = refCnt;
+<a name="l00194"></a>00194                 cptr.<a class="code" href="classbdm_1_1shared__ptr.html#7069b0472e45169e4c6b1c48bef8fcfb">payload</a> = payload;
+<a name="l00195"></a>00195                 add_ref();
+<a name="l00196"></a>00196                 <span class="keywordflow">return</span> cptr;
+<a name="l00197"></a>00197         }
+<a name="l00198"></a>00198 
+<a name="l00202"></a><a class="code" href="classbdm_1_1shared__ptr.html#fca7fd588f8de50e7590357305b00984">00202</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1shared__ptr.html#fca7fd588f8de50e7590357305b00984" title="Efficient swap for shared_ptr.">swap</a> ( <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a> &amp;other ) {
+<a name="l00203"></a>00203                 <a class="code" href="classbdm_1_1shared__ptr.html#fca7fd588f8de50e7590357305b00984" title="Efficient swap for shared_ptr.">std::swap</a> ( payload, other.<a class="code" href="classbdm_1_1shared__ptr.html#7069b0472e45169e4c6b1c48bef8fcfb">payload</a> );
+<a name="l00204"></a>00204                 <a class="code" href="classbdm_1_1shared__ptr.html#fca7fd588f8de50e7590357305b00984" title="Efficient swap for shared_ptr.">std::swap</a> ( refCnt, other.<a class="code" href="classbdm_1_1shared__ptr.html#a061592b1c666f418c71626d2607f554">refCnt</a> );
+<a name="l00205"></a>00205         }
+<a name="l00206"></a>00206 
+<a name="l00207"></a>00207 <span class="keyword">private</span>:
+<a name="l00208"></a>00208         <span class="keywordtype">void</span> add_ref()<span class="keyword"> const </span>{
+<a name="l00209"></a>00209                 <span class="keywordflow">if</span> ( refCnt ) {
+<a name="l00210"></a>00210                         <span class="keywordflow">if</span> ( *refCnt == UINT_MAX ) {
+<a name="l00211"></a>00211                                 <span class="keywordflow">throw</span> std::overflow_error (
+<a name="l00212"></a>00212                                     std::string ( <span class="stringliteral">"Shared pointer has too many references."</span> ) );
+<a name="l00213"></a>00213                         }
+<a name="l00214"></a>00214 
+<a name="l00215"></a>00215                         ++*refCnt;
+<a name="l00216"></a>00216                 }
+<a name="l00217"></a>00217         }
+<a name="l00218"></a>00218 
+<a name="l00219"></a>00219         <span class="keywordtype">void</span> del_ref() {
+<a name="l00220"></a>00220                 <span class="keywordflow">if</span> ( refCnt ) {
+<a name="l00221"></a>00221                         <span class="keywordflow">if</span> ( ! ( --*refCnt ) ) {
+<a name="l00222"></a>00222                                 <span class="keyword">delete</span> payload;
+<a name="l00223"></a>00223                                 <span class="keyword">delete</span> refCnt;
+<a name="l00224"></a>00224                         }
+<a name="l00225"></a>00225                 }
+<a name="l00226"></a>00226         }
+<a name="l00227"></a>00227 };
+<a name="l00228"></a>00228 
+<a name="l00230"></a>00230 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
+<a name="l00231"></a>00231 <span class="keywordtype">bool</span> operator== ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
+<a name="l00232"></a>00232         <span class="keywordflow">return</span> a.get() == b.get();
+<a name="l00233"></a>00233 }
+<a name="l00234"></a>00234 
+<a name="l00236"></a>00236 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
+<a name="l00237"></a>00237 <span class="keywordtype">bool</span> operator!= ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
+<a name="l00238"></a>00238         <span class="keywordflow">return</span> a.get() != b.get();
+<a name="l00239"></a>00239 }
+<a name="l00240"></a>00240 
+<a name="l00242"></a>00242 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> U&gt;
+<a name="l00243"></a>00243 <span class="keywordtype">bool</span> operator&lt; ( shared_ptr&lt;T&gt; <span class="keyword">const</span> &amp;a, shared_ptr&lt;U&gt; <span class="keyword">const</span> &amp;b ) {
+<a name="l00244"></a>00244         <span class="keywordflow">return</span> a.get() &lt; b.get();
+<a name="l00245"></a>00245 }
+<a name="l00246"></a>00246 
+<a name="l00254"></a>00254 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
+<a name="l00255"></a><a class="code" href="classbdm_1_1object__ptr.html">00255</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a>&lt;T&gt;
+<a name="l00256"></a>00256 {
+<a name="l00257"></a>00257 <span class="keyword">public</span>:
+<a name="l00263"></a><a class="code" href="classbdm_1_1object__ptr.html#9f1016ff2bbfa497d1cc0a4497c1fba4">00263</a>         <a class="code" href="classbdm_1_1object__ptr.html#9f1016ff2bbfa497d1cc0a4497c1fba4" title="Default constructor.">object_ptr</a>() : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( new T() ) { }
+<a name="l00264"></a>00264 
+<a name="l00270"></a><a class="code" href="classbdm_1_1object__ptr.html#dcb20017177c98274c16087b2c0067dc">00270</a>         <a class="code" href="classbdm_1_1object__ptr.html#dcb20017177c98274c16087b2c0067dc" title="Upcast from shared_ptr&amp;lt;T&amp;gt; to object_ptr&amp;lt;T&amp;gt;.">object_ptr</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;T&gt;</a> &amp;b ) : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( b ) {
+<a name="l00271"></a>00271                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( this-&gt;<span class="keyword">get</span>(), <span class="stringliteral">"object_ptr cannot be empty"</span> );
+<a name="l00272"></a>00272         }
+<a name="l00273"></a>00273 
+<a name="l00278"></a><a class="code" href="classbdm_1_1object__ptr.html#a9eb00600d8640711eadeed98c7892e9">00278</a>         <a class="code" href="classbdm_1_1object__ptr.html#a9eb00600d8640711eadeed98c7892e9">object_ptr</a> ( T *p ) : <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr</a>&lt;T&gt; ( p ) {
+<a name="l00279"></a>00279                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( p, <span class="stringliteral">"object_ptr cannot be empty"</span> );
+<a name="l00280"></a>00280         }
+<a name="l00281"></a>00281 
+<a name="l00285"></a><a class="code" href="classbdm_1_1object__ptr.html#9c80da05b7b3dfc59333ca9bf6f62970">00285</a>         <a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr&lt;T&gt;</a> &amp;<a class="code" href="classbdm_1_1object__ptr.html#9c80da05b7b3dfc59333ca9bf6f62970" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classbdm_1_1object__ptr.html" title="A wrapper of shared_ptr which is never empty.">object_ptr&lt;T&gt;</a> &amp;other ) {
+<a name="l00286"></a>00286                 <a class="code" href="classbdm_1_1object__ptr.html#9c80da05b7b3dfc59333ca9bf6f62970" title="Assignment operator.">shared_ptr&lt;T&gt;::operator= </a>( other );
+<a name="l00287"></a>00287                 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
+<a name="l00288"></a>00288         }
+<a name="l00289"></a>00289 };
+<a name="l00290"></a>00290 
+<a name="l00291"></a>00291 <span class="preprocessor">#define SHAREDPTR(class_name) typedef bdm::object_ptr&lt; class_name &gt; class_name##_ptr</span>
+<a name="l00292"></a>00292 <span class="preprocessor"></span>
+<a name="l00293"></a>00293 <span class="preprocessor">#define SHAREDPTR2(template_class_name, template_parameter_name) typedef bdm::object_ptr&lt; template_class_name &lt; template_parameter_name &gt; &gt; template_class_name##_##template_parameter_name##_ptr</span>
+<a name="l00294"></a>00294 <span class="preprocessor"></span>
+<a name="l00295"></a>00295 }
+<a name="l00296"></a>00296 
+<a name="l00297"></a>00297 <span class="preprocessor">#endif</span>
 </pre></div></div>
-<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 16 17:58:18 2009 for mixpp by&nbsp;
+<hr size="1"><address style="text-align: right;"><small>Generated on Sat Aug 29 20:49:42 2009 for mixpp by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
