From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/bit__set_8h-source.html | 194 +++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 docs/doxygen/nel/bit__set_8h-source.html (limited to 'docs/doxygen/nel/bit__set_8h-source.html') diff --git a/docs/doxygen/nel/bit__set_8h-source.html b/docs/doxygen/nel/bit__set_8h-source.html new file mode 100644 index 00000000..dbf7c9a4 --- /dev/null +++ b/docs/doxygen/nel/bit__set_8h-source.html @@ -0,0 +1,194 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

bit_set.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_BIT_SET_H
+00027 #define NL_BIT_SET_H
+00028 
+00029 
+00030 #include "nel/misc/types_nl.h"
+00031 #include "nel/misc/stream.h"
+00032 
+00033 
+00034 namespace       NLMISC
+00035 {
+00036 
+00037 // Size in bit of base word.
+00038 #define NL_BITLEN                       (4*8)
+00039 #define NL_BITLEN_SHIFT         5
+00040 
+00041 
+00042 // ***************************************************************************
+00049 class   CBitSet
+00050 {
+00051 public:
+00053 
+00054         CBitSet();
+00055         CBitSet(uint numBits);
+00056         CBitSet(const CBitSet &bs);
+00057         ~CBitSet();
+00058         CBitSet &operator=(const CBitSet &bs);
+00060 
+00062 
+00063 
+00064         void    resize (uint numBits);
+00066         void    resizeNoReset (uint numBits, bool value=false);
+00068         void    clear();
+00070         uint    size() const;
+00072         void    set(sint bitNumber, bool value)
+00073         {
+00074                 nlassert(bitNumber>=0 && bitNumber<NumBits);
+00075 
+00076                 uint    mask= bitNumber&(NL_BITLEN-1);
+00077                 mask= 1<<mask;
+00078                 if(value)
+00079                         Array[bitNumber >> NL_BITLEN_SHIFT]|= mask ;
+00080                 else
+00081                         Array[bitNumber >> NL_BITLEN_SHIFT]&= ~mask;
+00082         }
+00084         bool    get(sint bitNumber) const
+00085         {
+00086                 nlassert(bitNumber>=0 && bitNumber<NumBits);
+00087 
+00088                 uint    mask= bitNumber&(NL_BITLEN-1);
+00089                 mask= 1<<mask;
+00090                 return (Array[bitNumber >> NL_BITLEN_SHIFT] & mask) != 0;
+00091         }
+00093         bool    operator[](sint bitNumber) const
+00094         {
+00095                 return get(bitNumber);
+00096         }
+00098         void    set(sint bitNumber) {set(bitNumber, true);}
+00100         void    clear(sint bitNumber) {set(bitNumber, false);}
+00102         void    setAll();
+00104         void    clearAll();
+00106 
+00107 
+00109 
+00110 
+00111         CBitSet operator~() const;
+00116         CBitSet operator&(const CBitSet &bs) const;
+00121         CBitSet operator|(const CBitSet &bs) const;
+00126         CBitSet operator^(const CBitSet &bs) const;
+00127 
+00129         void    flip();
+00134         CBitSet &operator&=(const CBitSet &bs);
+00139         CBitSet &operator|=(const CBitSet &bs);
+00144         CBitSet &operator^=(const CBitSet &bs);
+00146 
+00147 
+00149 
+00150 
+00154         bool    compareRestrict(const CBitSet &bs) const;
+00156         bool    operator==(const CBitSet &bs) const;
+00158         bool    operator!=(const CBitSet &bs) const;
+00160         bool    allSet();
+00162         bool    allCleared();
+00164 
+00165 
+00166         void    serial(NLMISC::IStream &f);
+00167 
+00168 private:
+00169         std::vector<uint32>     Array;
+00170         sint                    NumBits;
+00171         uint32                  MaskLast;       // Mask for the last uint32.
+00172 };
+00173 
+00174 
+00175 }
+00176 
+00177 
+00178 
+00179 #endif // NL_BIT_SET_H
+00180 
+00181 /* End of bit_set.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1