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/bit__set_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/bit__set_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/bit__set_8cpp-source.html | 403 |
1 files changed, 403 insertions, 0 deletions
diff --git a/docs/doxygen/nel/bit__set_8cpp-source.html b/docs/doxygen/nel/bit__set_8cpp-source.html new file mode 100644 index 00000000..7aa8a93c --- /dev/null +++ b/docs/doxygen/nel/bit__set_8cpp-source.html @@ -0,0 +1,403 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.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">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>bit_set.cpp</h1><a href="bit__set_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="bit__set_8h.html">nel/misc/bit_set.h</a>"</font> +00029 +00030 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00031 +00032 +00033 <font class="keyword">namespace </font>NLMISC +00034 { +00035 +00036 <font class="comment">// must be defined elsewhere</font> +00037 <font class="preprocessor">#ifndef min</font> +<a name="l00038"></a><a class="code" href="bit__set_8cpp.html#a0">00038</a> <font class="preprocessor"></font><font class="preprocessor">#define min(a,b) (((a) < (b)) ? (a) : (b))</font> +00039 <font class="preprocessor"></font><font class="preprocessor">#endif</font> +00040 <font class="preprocessor"></font> +00041 +00042 +00043 <font class="comment">// ***************************************************************************</font> +<a name="l00044"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z271_0">00044</a> CBitSet::CBitSet() +00045 { +00046 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= 0; +00047 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= 0; +00048 } +<a name="l00049"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z271_1">00049</a> CBitSet::CBitSet(uint numBits) +00050 { +00051 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= 0; +00052 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= 0; +00053 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_0">resize</a>(numBits); +00054 } +<a name="l00055"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z271_2">00055</a> CBitSet::CBitSet(<font class="keyword">const</font> CBitSet &bs) +00056 { +00057 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= bs.NumBits; +00058 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= bs.MaskLast; +00059 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>= bs.Array; +00060 } +<a name="l00061"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z271_3">00061</a> CBitSet::~CBitSet() +00062 { +00063 } +<a name="l00064"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z271_4">00064</a> CBitSet &CBitSet::operator=(<font class="keyword">const</font> CBitSet &bs) +00065 { +00066 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= bs.NumBits; +00067 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= bs.MaskLast; +00068 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>= bs.Array; +00069 +00070 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00071 } +00072 +00073 +00074 <font class="comment">// ***************************************************************************</font> +<a name="l00075"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_2">00075</a> <font class="keywordtype">void</font> CBitSet::clear() +00076 { +00077 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.clear(); +00078 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= 0; +00079 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>=0; +00080 } +<a name="l00081"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_0">00081</a> <font class="keywordtype">void</font> CBitSet::resize(uint numBits) +00082 { +00083 <font class="keywordflow">if</font>(numBits==0) +00084 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_2">clear</a>(); +00085 +00086 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= numBits; +00087 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.resize( (<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>+<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) / <a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a> ); +00088 uint nLastBits= <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a> & (<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) ; +00089 <font class="comment">// Generate the mask for the last word.</font> +00090 <font class="keywordflow">if</font>(nLastBits==0) +00091 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= ~((uint)0); +00092 <font class="keywordflow">else</font> +00093 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= (1<< nLastBits) -1; +00094 +00095 <font class="comment">// reset to 0.</font> +00096 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_10">clearAll</a>(); +00097 } +<a name="l00098"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_1">00098</a> <font class="keywordtype">void</font> CBitSet::resizeNoReset(uint numBits, <font class="keywordtype">bool</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>) +00099 { +00100 <font class="keywordflow">if</font>(numBits==0) +00101 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_2">clear</a>(); +00102 +00103 uint oldNum=<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>; +00104 <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>= numBits; +00105 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.resize( (<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>+<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) / <a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a> ); +00106 uint nLastBits= <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a> & (<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) ; +00107 <font class="comment">// Generate the mask for the last word.</font> +00108 <font class="keywordflow">if</font>(nLastBits==0) +00109 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= ~((uint)0); +00110 <font class="keywordflow">else</font> +00111 <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>= (1<< nLastBits) -1; +00112 +00113 <font class="comment">// Set new bit to value</font> +00114 <font class="keywordflow">for</font> (uint i=oldNum; i<(uint)<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>; i++) +00115 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_4">set</a>(i, <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>); +00116 } +<a name="l00117"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_3">00117</a> uint <a class="code" href="cf__lexical_8cpp.html#a94">CBitSet::size</a>()<font class="keyword"> const</font> +00118 <font class="keyword"></font>{ +00119 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>; +00120 } +<a name="l00121"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_9">00121</a> <font class="keywordtype">void</font> CBitSet::setAll() +00122 { +00123 fill_n(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.begin(), <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size(), ~((uint)0)); +00124 +00125 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]&= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>; +00126 } +<a name="l00127"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z272_10">00127</a> <font class="keywordtype">void</font> CBitSet::clearAll() +00128 { +00129 fill_n(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.begin(), <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size(), 0); +00130 } +00131 +00132 +00133 <font class="comment">// ***************************************************************************</font> +<a name="l00134"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_0">00134</a> CBitSet CBitSet::operator~()<font class="keyword"> const</font> +00135 <font class="keyword"></font>{ +00136 <a class="code" href="classNLMISC_1_1CBitSet.html#z271_0">CBitSet</a> ret; +00137 +00138 ret= *<font class="keyword">this</font>; +00139 ret.flip(); +00140 <font class="keywordflow">return</font> ret; +00141 } +<a name="l00142"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_1">00142</a> CBitSet CBitSet::operator&(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00143 <font class="keyword"></font>{ +00144 <a class="code" href="classNLMISC_1_1CBitSet.html#z271_0">CBitSet</a> ret; +00145 +00146 ret= *<font class="keyword">this</font>; +00147 ret&=bs; +00148 <font class="keywordflow">return</font> ret; +00149 } +<a name="l00150"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_2">00150</a> CBitSet CBitSet::operator|(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00151 <font class="keyword"></font>{ +00152 <a class="code" href="classNLMISC_1_1CBitSet.html#z271_0">CBitSet</a> ret; +00153 +00154 ret= *<font class="keyword">this</font>; +00155 ret|=bs; +00156 <font class="keywordflow">return</font> ret; +00157 } +<a name="l00158"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_3">00158</a> CBitSet CBitSet::operator^(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00159 <font class="keyword"></font>{ +00160 <a class="code" href="classNLMISC_1_1CBitSet.html#z271_0">CBitSet</a> ret; +00161 +00162 ret= *<font class="keyword">this</font>; +00163 ret^=bs; +00164 <font class="keywordflow">return</font> ret; +00165 } +00166 +00167 +00168 <font class="comment">// ***************************************************************************</font> +<a name="l00169"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_4">00169</a> <font class="keywordtype">void</font> CBitSet::flip() +00170 { +00171 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00172 <font class="keywordflow">return</font>; +00173 +00174 <font class="keywordflow">for</font>(sint i=0;i<(sint)<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size();i++) +00175 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]= ~<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]; +00176 +00177 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]&= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>; +00178 } +<a name="l00179"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_5">00179</a> CBitSet &CBitSet::operator&=(<font class="keyword">const</font> CBitSet &bs) +00180 { +00181 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00182 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00183 +00184 sint minSize= <a class="code" href="bit__set_8cpp.html#a0">min</a>(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size(), bs.Array.size()); +00185 sint i; +00186 <font class="keywordflow">for</font>(i=0;i<minSize;i++) +00187 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]= <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i] & bs.Array[i]; +00188 <font class="keywordflow">for</font>(i=minSize;i<(sint)<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size();i++) +00189 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]=0; +00190 +00191 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]&= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>; +00192 +00193 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00194 } +<a name="l00195"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_6">00195</a> CBitSet &CBitSet::operator|=(<font class="keyword">const</font> CBitSet &bs) +00196 { +00197 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00198 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00199 +00200 sint minSize= <a class="code" href="bit__set_8cpp.html#a0">min</a>(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size(), bs.Array.size()); +00201 <font class="keywordflow">for</font>(sint i=0;i<minSize;i++) +00202 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]= <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i] | bs.Array[i]; +00203 <font class="comment">// Do nothing for bits word from minSize to Array.size().</font> +00204 +00205 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]&= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>; +00206 +00207 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00208 } +<a name="l00209"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z273_7">00209</a> CBitSet &CBitSet::operator^=(<font class="keyword">const</font> CBitSet &bs) +00210 { +00211 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00212 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00213 +00214 sint minSize= <a class="code" href="bit__set_8cpp.html#a0">min</a>(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size(), bs.Array.size()); +00215 <font class="keywordflow">for</font>(sint i=0;i<minSize;i++) +00216 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]= <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i] ^ bs.Array[i]; +00217 <font class="comment">// Do nothing for bits word from minSize to Array.size().</font> +00218 +00219 <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]&= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a>; +00220 +00221 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00222 } +00223 +00224 +00225 <font class="comment">// ***************************************************************************</font> +<a name="l00226"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z274_1">00226</a> <font class="keywordtype">bool</font> CBitSet::operator==(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00227 <font class="keyword"></font>{ +00228 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>!=bs.NumBits) +00229 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00230 +00231 <font class="keywordflow">for</font>(sint i=0;i<(sint)<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size();i++) +00232 { +00233 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]!=bs.Array[i]) +00234 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00235 } +00236 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00237 } +<a name="l00238"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z274_2">00238</a> <font class="keywordtype">bool</font> CBitSet::operator!=(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00239 <font class="keyword"></font>{ +00240 <font class="keywordflow">return</font> (!<a class="code" href="classNLMISC_1_1CBitSet.html#z274_1">operator==</a>(bs)); +00241 } +<a name="l00242"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z274_0">00242</a> <font class="keywordtype">bool</font> CBitSet::compareRestrict(<font class="keyword">const</font> CBitSet &bs)<font class="keyword"> const</font> +00243 <font class="keyword"></font>{ +00244 sint n=<a class="code" href="bit__set_8cpp.html#a0">min</a>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>, bs.NumBits); +00245 <font class="keywordflow">if</font>(n==0) <font class="keywordflow">return</font> <font class="keyword">true</font>; +00246 +00247 sint nA= (n+<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) / <a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>; +00248 uint mask; +00249 +00250 uint nLastBits= n & (<a class="code" href="bit__set_8h.html#a0">NL_BITLEN</a>-1) ; +00251 <font class="comment">// Generate the mask for the last common word.</font> +00252 <font class="keywordflow">if</font>(nLastBits==0) +00253 mask= ~((uint)0); +00254 <font class="keywordflow">else</font> +00255 mask= (1<< nLastBits) -1; +00256 +00257 +00258 <font class="keywordflow">for</font>(sint i=0;i<nA-1;i++) +00259 { +00260 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]!=bs.Array[i]) +00261 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00262 } +00263 <font class="keywordflow">if</font>( (<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[nA-1]&mask) != (bs.Array[nA-1]&mask) ) +00264 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00265 +00266 +00267 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00268 } +<a name="l00269"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z274_3">00269</a> <font class="keywordtype">bool</font> CBitSet::allSet() +00270 { +00271 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00272 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00273 <font class="keywordflow">for</font>(sint i=0;i<(sint)<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1;i++) +00274 { +00275 <font class="keywordflow">if</font>( <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]!= (~((uint)0)) ) +00276 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00277 } +00278 <font class="keywordflow">if</font>( <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size()-1]!= <a class="code" href="classNLMISC_1_1CBitSet.html#o2">MaskLast</a> ) +00279 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00280 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00281 } +<a name="l00282"></a><a class="code" href="classNLMISC_1_1CBitSet.html#z274_4">00282</a> <font class="keywordtype">bool</font> CBitSet::allCleared() +00283 { +00284 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#o1">NumBits</a>==0) +00285 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00286 <font class="keywordflow">for</font>(sint i=0;i<(sint)<a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>.size();i++) +00287 { +00288 <font class="keywordflow">if</font>( <a class="code" href="classNLMISC_1_1CBitSet.html#o0">Array</a>[i]!= 0 ) +00289 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00290 } +00291 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00292 } +00293 +00294 +00295 +<a name="l00296"></a><a class="code" href="classNLMISC_1_1CBitSet.html#a0">00296</a> <font class="keywordtype">void</font> CBitSet::serial(IStream &f) +00297 { +00298 (void)f.serialVersion(0); +00299 uint32 sz=0; +00300 vector<uint32> array32; +00301 +00302 <font class="comment">// Must support any size of uint.</font> +00303 <font class="keywordflow">if</font>(f.isReading()) +00304 { +00305 f.serial(sz); +00306 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_0">resize</a>(sz); +00307 +00308 f.serialCont(array32); +00309 <font class="keywordflow">for</font>(sint i=0;i<(sint)sz;i++) +00310 { +00311 uint32 a=array32[i/32]; +00312 a&= 1<<(i&31); +00313 <a class="code" href="classNLMISC_1_1CBitSet.html#z272_4">set</a>(i, a!=0); +00314 } +00315 } +00316 <font class="keywordflow">else</font> +00317 { +00318 sz= <a class="code" href="classNLMISC_1_1CBitSet.html#z272_3">size</a>(); +00319 f.serial(sz); +00320 +00321 array32.resize(sz/32); +00322 fill_n(array32.begin(), array32.size(), 0); +00323 <font class="keywordflow">for</font>(sint i=0;i<(sint)sz;i++) +00324 { +00325 <font class="keywordflow">if</font>(<a class="code" href="classNLMISC_1_1CBitSet.html#z272_5">get</a>(i)) +00326 array32[i/32]|= 1<<(i&31); +00327 } +00328 f.serialCont(array32); +00329 } +00330 } +00331 +00332 +00333 } +00334 +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |