8 #ifndef INCL_evo_bit_array_h     9 #define INCL_evo_bit_array_h   122 template<
class TParent>
   127     typedef typename TParent::Size  
Size;       
   128     typedef typename TParent::Value 
Value;      
   137     BitArraySubsetT(
const Parent& 
parent) : parent_rd_(&parent), parent_wr_(NULL), offset_(0), bitsize_(parent.bitsize_) {
   167     BitArraySubsetT(
const ThisType& src) : parent_rd_(src.parent_rd_), parent_wr_(src.parent_wr_), offset_(src.offset_), bitsize_(src.bitsize_) {
   170 #if defined(EVO_CPP11)   175         ::memcpy(
this, &src, 
sizeof(ThisType));
   176         ::memset(&src, 0, 
sizeof(ThisType));
   184         ::memcpy(
this, &src, 
sizeof(ThisType));
   185         ::memset(&src, 0, 
sizeof(ThisType));
   197         parent_rd_ = src.parent_rd_;
   198         parent_wr_ = src.parent_wr_;
   199         offset_ = src.offset_;
   200         bitsize_ = src.bitsize_;
   212         bitsize_ = parent.size();
   221         parent_rd_ = parent_wr_ = &
parent;
   223         bitsize_ = parent.size();
   231         parent_rd_ = parent_wr_ = NULL;
   243     ThisType& 
set(
const ThisType& src, Size pos=0, Size count=
ALL) {
   244         parent_rd_ = src.parent_rd_;
   245         parent_wr_ = src.parent_wr_;
   246         offset_ = src.offset_ + pos;
   247         if (offset_ > src.bitsize_) {
   248             offset_ = src.bitsize_;
   251             bitsize_ = src.bitsize_ - offset_;
   252             if (bitsize_ > count)
   263     ThisType& 
set(
const Parent& 
parent, Size pos=0, Size count=
ALL) {
   267         if (offset_ > parent.bitsize_) {
   268             offset_ = parent.bitsize_;
   271             bitsize_ = parent.bitsize_ - offset_;
   272             if (bitsize_ > count)
   283     ThisType& 
set(Parent& 
parent, Size pos=0, Size count=
ALL) {
   284         parent_rd_ = parent_wr_ = &
parent;
   286         if (offset_ > parent.bitsize_) {
   287             offset_ = parent.bitsize_;
   290             bitsize_ = parent.bitsize_ - offset_;
   291             if (bitsize_ > count)
   305         return (parent_rd_ == NULL);
   314         return (bitsize_ == 0);
   337         return (parent_wr_ == NULL);
   364         return (parent_rd_ != NULL && pos < bitsize_ && 
Bits<Value,Size>::array_get(parent_rd_->data_, parent_rd_->bitsize_, offset_ + pos));
   375         if (parent_rd_ == NULL)
   408         return (parent_rd_ != NULL && pos < bitsize_ && 
Bits<Value,Size>::array_get(parent_rd_->data_, parent_rd_->bitsize_, offset_ + pos));
   420         return (parent_wr_ != NULL && pos < bitsize_ && 
Bits<Value,Size>::array_set(parent_wr_->data_, parent_wr_->bitsize_, offset_ + pos, value));
   433         if (parent_wr_ != NULL && pos < bitsize_) {
   434             const Size maxcount = bitsize_ - pos;
   435             if (count > maxcount)
   450         return (parent_wr_ != NULL && pos < bitsize_ && 
Bits<Value,Size>::array_set(parent_wr_->data_, parent_wr_->bitsize_, offset_ + pos, 
false));
   462         if (parent_wr_ != NULL && pos < bitsize_) {
   463             const Size maxcount = bitsize_ - pos;
   464             if (count > maxcount)
   491         if (parent_wr_ != NULL && pos < bitsize_) {
   492             const Size maxcount = bitsize_ - pos;
   493             if (count > maxcount)
   516     bool store(Size pos, Size count, U value) {
   517         const Size maxcount = bitsize_ - pos;
   518         if (count > maxcount)
   520         return (parent_wr_ != NULL && pos < bitsize_ && 
Bits<Value,Size>::array_store(parent_wr_->data_, parent_wr_->bitsize_, offset_ + pos, count, value));
   535     template<
class U EVO_ONCPP11(=u
long)>
   537         if (parent_rd_ != NULL && pos < bitsize_) {
   538             const Size maxcount = bitsize_ - pos;
   539             if (count > maxcount)
   561     template<
class U EVO_ONCPP11(=u
long)>
   563         if (parent_rd_ != NULL && pos < bitsize_) {
   564             const Size maxcount = bitsize_ - pos;
   565             if (count > maxcount)
   588             assert( parent_rd_ != NULL );
   592                 digits = 
"0123456789abcdefghijklmnopqrstuvwxyz";
   594                 digits = 
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   598                 case 2:  bits_per_digit = 1; 
break;
   599                 case 4:  bits_per_digit = 2; 
break;
   600                 case 8:  bits_per_digit = 3; 
break;
   601                 case 16: bits_per_digit = 4; 
break;
   602                 case 32: bits_per_digit = 5; 
break;
   603                 default: 
return false;
   606             typename U::Out& outstream = out.write_out();
   607             typename U::Out::Size available = 0;
   609             Size outsize = (bitsize_ + bits_per_digit - 1) / bits_per_digit; 
   610             char* outbuf = outstream.write_direct_multi(available, outsize);
   614             char* outbuf_start = outbuf;
   615             char* outbuf_end   = outbuf + available;
   618             Size outsize_lastwrite = outsize;
   621             const Value* parent_data    = parent_rd_->data_;    
   622             const Size   parent_bitsize = offset_ + bitsize_;   
   626             const uint bits_per_ulong   = digits_per_ulong * bits_per_digit;
   628             outbuf_end -= digits_per_ulong;
   629             for (Size p=offset_; outsize > 0; p += bits_per_ulong) {
   630                 if (outbuf > outbuf_end) {
   632                     outbuf_start = outbuf = outstream.write_direct_flush(available, (ulong)(outbuf - outbuf_start), outsize);
   635                     outbuf_end = outbuf + available - digits_per_ulong;
   636                     outsize_lastwrite = outsize;
   639                 if (outsize < digits_per_ulong)
   640                     digit_count = outsize;
   642                     digit_count = digits_per_ulong;
   646                 outbuf_next = outbuf_write = outbuf + digit_count;
   647                 for (; num != 0; num /= (
Value)base)
   648                     *--outbuf_write = digits[num % base];
   649                 while (outbuf_write > outbuf)
   650                     *--outbuf_write = 
'0';
   651                 outsize -= digit_count;
   652                 outbuf = outbuf_next;
   655             assert( outsize_lastwrite >= outsize );
   656             outstream.write_direct_finish(outsize_lastwrite - outsize);
   671         else if (parent_rd_ == NULL)
   672             result = (data.parent_rd_ == NULL);
   673         else if (data.parent_rd_ == NULL || bitsize_ != data.bitsize_)
   675         else if (bitsize_ == 0)
   680             const Value* this_ptr     = parent_rd_->data_ + this_index;
   683             Size count = bitsize_;
   685             if (this_offset == other_offset) {
   687                 const Value* other_ptr = data.parent_rd_->data_ + other_index;
   690                 if (this_offset > 0) {
   692                     if ((*this_ptr & maskval) != (*other_ptr & maskval))
   702                     if (*this_ptr != *other_ptr)
   711                     if ((*this_ptr & maskval) != (*other_ptr & maskval))
   716                 const Value* other_ptr   = data.parent_rd_->data_;
   717                 const Size other_bitsize = data.parent_rd_->bitsize_;
   718                 Size       other_pos     = data.offset_;
   721                 if (this_offset > 0) {
   761     const Parent* parent_rd_;   
   899 template<
class T=u
long,
class TSize=SizeT>
   914     typedef Size IterItem;
   926     BitArrayT(Size bitsize) : data_(NULL), size_(0), bitsize_(0) {
   935             data_ = (Value*)::malloc((
size_t)src.size_ * 
sizeof(
Value));
   936             memcpy(data_, src.data_, src.size_ * 
sizeof(Value));
   940         bitsize_ = src.bitsize_;
   948     BitArrayT(
const ThisType& src, Size pos, Size count=
ALL) : data_(NULL), size_(0), bitsize_(0) {
   949         if (count > src.bitsize_)
   950             count = src.bitsize_;
   964     BitArrayT(
const Subset& subset, Size pos=0, Size count=
ALL) : data_(NULL), size_(0), bitsize_(0) {
   966         if (parent != NULL) {
   967             const Size subset_bitsize = subset.
size();
   968             if (count > subset_bitsize)
   969                 count = subset_bitsize;
   983 #if defined(EVO_CPP11)   988         const Size ITEM_BITS = 
sizeof(uint32) * 8;
   990         resize((Size)init.size() * ITEM_BITS);
   992         for (
auto num : init) {
   993             store(offset, ITEM_BITS, num);
  1002         ::memcpy(
this, &src, 
sizeof(ThisType));
  1003         ::memset(&src, 0, 
sizeof(ThisType));
  1012         ::memcpy(
this, &src, 
sizeof(ThisType));
  1013         ::memset(&src, 0, 
sizeof(ThisType));
  1069     ThisType& 
set(
const ThisType& src) {
  1071             if (src.size_ > 0) {
  1072                 const size_t size_bytes = (size_t)src.size_ * 
sizeof(Value);
  1073                 if (size_ == src.size_) {
  1075                     memcpy(data_, src.data_, size_bytes);
  1081                     data_ = (Value*)::malloc(size_bytes);
  1082                     memcpy(data_, src.data_, size_bytes);
  1084                 bitsize_ = src.bitsize_;
  1092                 data_ = (src.data_ == NULL ? NULL : 
EVO_PEMPTY);
  1104     ThisType& 
set(
const Subset& src) {
  1105         const ThisType* src_parent = src.parent();
  1106         if (
this == src_parent) {
  1109         } 
else if (src_parent == NULL) {
  1112             const Size src_size = src.size();
  1140         return (data_ == NULL);
  1149         return (bitsize_ == 0);
  1200         { 
return Iter(*
this); }
  1208         { 
return Iter(*
this); }
  1343     bool store(Size pos, Size count, U value) {
  1359     template<
class U EVO_ONCPP11(=u
int32)>
  1379     template<
class U EVO_ONCPP11(=u
int32)>
  1422             case 2:  bits_per_digit = 1; 
break;
  1423             case 4:  bits_per_digit = 2; 
break;
  1424             case 8:  bits_per_digit = 3; 
break;
  1425             case 16: bits_per_digit = 4; 
break;
  1426             case 32: bits_per_digit = 5; 
break;
  1431         while (size > 0 && ((ch=str[size-1]) == 
' ' || ch == 
'\t'))
  1433         const char* end = str + 
size;
  1434         while (str < end && ((ch=*str) == 
' ' || ch == 
'\t'))
  1439         size = (
Size)(end - str) * bits_per_digit; 
  1445         for (; str < end; ++str) {
  1447             if (ch >= 
'0' && ch <= 
'9')
  1449             else if (ch >= 
'A' && ch <= 
'V')
  1451             else if (ch >= 
'a' && ch <= 
'v')
  1458             bits += bits_per_digit;
  1461                 *p = T((num * (uint)base) + ch);
  1469                 *p = T(num << shift) | (T(ch) >> bits);
  1503                 digits = 
"0123456789abcdefghijklmnopqrstuvwxyz";
  1505                 digits = 
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  1509                 case 2:  bits_per_digit = 1; 
break;
  1510                 case 4:  bits_per_digit = 2; 
break;
  1511                 case 8:  bits_per_digit = 3; 
break;
  1512                 case 16: bits_per_digit = 4; 
break;
  1513                 case 32: bits_per_digit = 5; 
break;
  1514                 default: 
return false;
  1517             typename U::Out& outstream = out.write_out();
  1518             typename U::Out::Size available = 0;
  1520             Size outsize = (bitsize_ + bits_per_digit - 1) / bits_per_digit; 
  1521             char* outbuf = outstream.write_direct_multi(available, outsize);
  1525             char* outbuf_start = outbuf;
  1526             char* outbuf_end   = outbuf + available;
  1529             Size outsize_lastwrite = outsize, digit_count;
  1534                 const uint bits_per_ulong   = digits_per_ulong * bits_per_digit;
  1536                 outbuf_end -= digits_per_ulong;
  1537                 for (Size p=0; outsize > 0; p += bits_per_ulong) {
  1538                     digit_count = (outsize > digits_per_ulong ? digits_per_ulong : outsize);
  1540                     if (outbuf >= outbuf_end) {
  1542                         outbuf_start = outbuf = outstream.write_direct_flush(available, (ulong)(outbuf - outbuf_start), outsize);
  1545                         outbuf_end = outbuf + available - digits_per_ulong;
  1546                         outsize_lastwrite = outsize;
  1550                     outbuf_next = outbuf_write = outbuf + digit_count;
  1551                     for (; num != 0; num /= (T)base)
  1552                         *--outbuf_write = digits[num % base];
  1553                     while (outbuf_write > outbuf)
  1554                         *--outbuf_write = 
'0';
  1555                     outsize -= digit_count;
  1556                     outbuf = outbuf_next;
  1566                 while (outsize > 0) {
  1567                     if (outsize < digits_per_chunk)
  1568                         digit_count = outsize;
  1570                         digit_count = digits_per_chunk;
  1572                     outbuf_next = outbuf + digit_count;
  1573                     if (outbuf_next > outbuf_end && outbuf > outbuf_start) {
  1575                         outbuf_start = outbuf = outstream.write_direct_flush(available, (ulong)(outbuf - outbuf_start), outsize);
  1578                         outbuf_end  = outbuf + available;
  1579                         outbuf_next = outbuf + digit_count;
  1580                         outsize_lastwrite = outsize;
  1584                     outbuf_write = outbuf_next;
  1585                     if (p < p_end_rndup) {
  1589                         for (; num != 0; num /= (T)base)
  1590                             *--outbuf_write = digits[num % base];
  1593                     while (outbuf_write > outbuf)
  1594                         *--outbuf_write = 
'0';
  1595                     assert( outbuf_next > outbuf );
  1596                     outsize -= digit_count;
  1597                     outbuf = outbuf_next;
  1601             assert( outsize_lastwrite >= outsize );
  1602             outstream.write_direct_finish(outsize_lastwrite - outsize);
  1617         else if (data_ == NULL)
  1618             result = (data.data_ == NULL);
  1619         else if (data.data_ == NULL || size_ != data.size_)
  1634         else if (data_ == NULL)
  1635             result = (data.data_ != NULL);
  1636         else if (data.data_ == NULL || size_ != data.size_)
  1666         } 
else if (size_ != size) {
  1669             const size_t size_bytes = (size_t)size * 
sizeof(Value);
  1672                 Value* 
const old_data = data_;
  1673                 data_ = (Value*)::malloc(size_bytes);
  1675                 const size_t save_size_bytes = (size_ < size ? size_ : 
size) * 
sizeof(Value);
  1676                 memcpy(data_, old_data, save_size_bytes);
  1677                 if (size_bytes > save_size_bytes)
  1678                     memset((
char*)data_ + save_size_bytes, 0, size_bytes - save_size_bytes);
  1684                 data_ = (T*)::malloc(size_bytes);
  1685                 memset(data_, 0, size_bytes);
  1691             if (bitsize < bitsize_) {
  1694                 data_[size_ - 1] &= ~mask;
  1719     void iterInitMutable() { }
  1720     const IterItem* iterFirst(IterKey& key)
 const {
  1721         const IterItem* result;
  1724             if (key.offset == 
NONE)
  1727                 result = (
const IterItem*)&key.offset;
  1734     const IterItem* iterNext(IterKey& key)
 const {
  1735         const IterItem* result = NULL;
  1736         if (key.offset != 
END) {
  1738             if (key.offset == 
NONE)
  1741                 result = (
const IterItem*)&key.offset;
 ThisType & operator=(ThisType &&src)
Move assignment operator (C++11). 
Definition: bit_array.h:1010
 
Size setbits(Size pos=0, Size count=ALL, bool value=true)
Set or clear count bits at position in bit array. 
Definition: bit_array.h:1277
 
static Size array_set_multi(T *data, Size bitsize, Size pos=0, Size count=ALL, bool value=true)
Set or clear count bits at position in chunked bit array. 
Definition: bits.h:746
 
static Size array_iternext(IterState &state)
Iterate to next set bit in array. 
Definition: bits.h:664
 
static bool array_toggle(T *data, Size bitsize, Size pos)
Toggle bit at position in chunked bit array. 
Definition: bits.h:815
 
U extractl(Size pos=0, Size count=ALL) const
Extract bits from subset. 
Definition: bit_array.h:536
 
static bool array_get(const T *data, Size bitsize, Size pos)
Get bit at position from chunked bit array. 
Definition: bits.h:702
 
static void array_shiftl(T *data, Size bitsize, uint count)
Shift to the left in chunked bit array. 
Definition: bits.h:1163
 
Parent * parent_nonconst()
Get non-const pointer to parent BitArray. 
Definition: bit_array.h:350
 
bool clearbit(Size pos)
Clear bit at position in bit array. 
Definition: bit_array.h:1288
 
Size setbits(Size pos=0, Size count=ALL, bool value=true)
Set or clear count bits at position in subset. 
Definition: bit_array.h:432
 
A subset of a BitArray. 
Definition: bit_array.h:123
 
Static conditional type. 
Definition: meta.h:134
 
Iter cend() const
Get iterator at end (const). 
Definition: bit_array.h:1203
 
BitArrayT BitArray
Default dynamic bit array container – see BitArrayT. 
Definition: bit_array.h:1779
 
ThisType & resize(Size bitsize)
Resize while preserving existing data (modifier). 
Definition: bit_array.h:1656
 
bool clearbit(Size pos)
Clear bit at position in subset. 
Definition: bit_array.h:449
 
bool togglebit(Size pos)
Toggle bit at position in bit array. 
Definition: bit_array.h:1311
 
TParent::Value Value
Chunk value type. 
Definition: bit_array.h:128
 
BitArraySubsetT< TParent > ThisType
This BitArraySubset type. 
Definition: bit_array.h:125
 
ThisType & shiftl(uint count)
Shift all bits in bit bit array to the left. 
Definition: bit_array.h:1389
 
static bool array_checkall(const T *data, Size bitsize)
Check if all bits are set in bit array. 
Definition: bits.h:486
 
BitArraySubsetT< ThisType > Subset
Subset type for this bit array type. 
Definition: bit_array.h:904
 
bool format(U &out, int base=fBIN)
Format bits from subset to stream or string using base. 
Definition: bit_array.h:586
 
ThisType & operator=(const ThisType &src)
Assignment operator. 
Definition: bit_array.h:1033
 
bool store(Size pos, Size count, U value)
Stores bits from value in subset. 
Definition: bit_array.h:516
 
U extractl(Size pos=0, Size count=ALL) const
Extract bits from bit array. 
Definition: bit_array.h:1360
 
bool operator[](Size pos) const
Get bit at position in bit array (const). 
Definition: bit_array.h:1184
 
bool operator!=(const ThisType &data) const
Inequality operator. 
Definition: bit_array.h:1630
 
BitArrayT(std::initializer_list< uint32 > init)
Sequence constructor that initializes bits from a list of uint32 values (C++11). 
Definition: bit_array.h:987
 
bool setbit(Size pos, bool value=true)
Set or clear bit at position in bit array. 
Definition: bit_array.h:1264
 
Evo implementation detail: String helpers. 
 
bool operator!=(const ThisType &data) const
Inequality operator. 
Definition: bit_array.h:756
 
bool null() const
Get whether null. 
Definition: bit_array.h:1139
 
bool store(Size pos, Size count, U value)
Stores bits from value in bit array. 
Definition: bit_array.h:1343
 
bool getbit(Size pos) const
Get bit at position in subset (const). 
Definition: bit_array.h:407
 
bool checkany() const
Check if any bits are set in subset (const). 
Definition: bit_array.h:396
 
BitArrayT< T, TSize > ThisType
This bit array type. 
Definition: bit_array.h:903
 
TParent Parent
Parent BitArray type. 
Definition: bit_array.h:126
 
bool operator==(const ThisType &data) const
Equality operator. 
Definition: bit_array.h:1613
 
Size size() const
Get size as number of bits in subset. 
Definition: bit_array.h:320
 
ThisType & resize_pow2(Size bitsize)
Resize as power of 2 while preserving existing data (modifier). 
Definition: bit_array.h:1708
 
Basic integer type. 
Definition: type.h:980
 
bool null() const
Get whether null. 
Definition: bit_array.h:304
 
Size offset() const
Get subset offset position in parent. 
Definition: bit_array.h:327
 
bool empty() const
Get whether empty. 
Definition: bit_array.h:1148
 
bool getbit(Size pos) const
Get bit at position in bit array (const). 
Definition: bit_array.h:1252
 
ThisType & unshare()
Make data unique – no-op. 
Definition: bit_array.h:1648
 
Iter begin() const
Get iterator at first item (const). 
Definition: bit_array.h:1207
 
bool setbit(Size pos, bool value=true)
Set or clear bit at position in subset. 
Definition: bit_array.h:419
 
static Size array_toggle_multi(T *data, Size bitsize, Size pos=0, Size count=ALL)
Toggle count bits at position in chunked bit array. 
Definition: bits.h:835
 
#define EVO_PEMPTY
Special pointer value for empty but not NULL (used in containers). 
Definition: type.h:1858
 
BitArraySubsetT(const ThisType &src)
Copy constructor to reference the same parent and subset. 
Definition: bit_array.h:167
 
BitArraySubsetT< BitArray > BitArraySubset
Default subset of a BitArray – see BitArraySubsetT. 
Definition: bit_array.h:1780
 
BitArrayT(const Subset &subset, Size pos=0, Size count=ALL)
Copy from subset. 
Definition: bit_array.h:964
 
U extractr(Size pos=0, Size count=ALL) const
Extract bits from subset. 
Definition: bit_array.h:562
 
Size clearbits(Size pos=0, Size count=ALL) const
Clear count bits at position in subset. 
Definition: bit_array.h:461
 
ThisType & shiftr(uint count)
Shift all bits in bit bit array to the right. 
Definition: bit_array.h:1399
 
Size load(const char *str, Size size, int base=2)
Parse and load bits from numeric string. 
Definition: bit_array.h:1416
 
static bool array_store(T *data, Size bitsize, Size pos, Size count, U value)
Stores bits in chunked bit array. 
Definition: bits.h:895
 
static Size array_copy(T *data, Size bitsize, T *src_data, Size src_bitsize, Size src_pos=0, Size src_count=ALL)
Copy bits from another array. 
Definition: bits.h:1100
 
Evo implementation detail: Container iterators. 
 
ulong hash(ulong seed=0) const
Get data hash value for whole bit array. 
Definition: bit_array.h:1192
 
Size countbits(bool value=true) const
Count number of bits set or cleared in subset (const). 
Definition: bit_array.h:374
 
Base 2: binary. 
Definition: str.h:2321
 
Size countbits(bool value=true) const
Count number of bits set or cleared (const). 
Definition: bit_array.h:1221
 
BitArraySubsetT(ThisType &&src)
Move constructor (C++11). 
Definition: bit_array.h:174
 
BitArraySubsetT(const Parent &parent)
Constructor to reference a parent BitArray as read-only. 
Definition: bit_array.h:137
 
Size size() const
Get bit size. 
Definition: bit_array.h:1155
 
bool empty() const
Get whether empty. 
Definition: bit_array.h:313
 
bool togglebit(Size pos)
Toggle bit at position in subset. 
Definition: bit_array.h:478
 
Size checkall() const
Check if all bits are set in subset (const). 
Definition: bit_array.h:387
 
static const EndT END
Special integer value for indicating end of items or no item. 
Definition: type.h:1846
 
BitArrayT(ThisType &&src)
Move constructor (C++11). 
Definition: bit_array.h:1001
 
bool format(U &out, int base=fBIN)
Format bits to stream or string using base. 
Definition: bit_array.h:1498
 
static Size array_countbits(const T *data, Size bitsize)
Count number of set bits in bit array. 
Definition: bits.h:418
 
Size togglebits(Size pos=0, uint count=ALL)
Toggle count bits at position in subset. 
Definition: bit_array.h:490
 
BitArraySubsetT()
Constructor sets as null. 
Definition: bit_array.h:131
 
static const EndT ALL
Special integer value for indicating all items or all remaining items. 
Definition: type.h:1839
 
ThisType & clear()
Clear by freeing all values. 
Definition: bit_array.h:1042
 
bool operator==(const ThisType &data) const
Equality operator. 
Definition: bit_array.h:667
 
Forward iterator. 
Definition: iter.h:340
 
ThisType & setempty()
Set as empty but not null. 
Definition: bit_array.h:1122
 
static ulong hash(const T *data, ulong size, ulong seed=0)
Compute hash value from data. 
Definition: container.h:899
 
bool checkany() const
Check if any bits are set in bit array (const). 
Definition: bit_array.h:1241
 
const Value * data() const
Get data pointer (const). 
Definition: bit_array.h:1173
 
Evo C++ Library namespace. 
Definition: alg.h:11
 
static const EndT NONE
Special integer value for indicating no item or unknown item. 
Definition: type.h:1832
 
Size togglebits(Size pos=0, uint count=ALL)
Toggle count bits at position in bit array. 
Definition: bit_array.h:1323
 
IteratorFw< ThisType >::Const Iter
Iterator (const) - IteratorFw. 
Definition: bit_array.h:917
 
static bool equal(const T *data1, const T *data2, ulong size)
Compare array data for equality. 
Definition: container.h:721
 
Size clearbits(Size pos=0, Size count=ALL) const
Clear count bits at position in bit array. 
Definition: bit_array.h:1300
 
Iter end() const
Get iterator at end (const). 
Definition: bit_array.h:1211
 
BitArraySubsetT(const Parent &parent, Size pos, Size count=ALL)
Constructor to reference a subset of parent BitArray as read-only. 
Definition: bit_array.h:151
 
BitArrayT(const ThisType &src)
Copy constructor. 
Definition: bit_array.h:933
 
T Value
Chunk value type for bits. 
Definition: bit_array.h:906
 
TSize Size
Size integer type. 
Definition: bit_array.h:905
 
ThisType & operator=(ThisType &&src)
Move assignment operator (C++11). 
Definition: bit_array.h:183
 
static bool array_set(T *data, Size bitsize, Size pos, bool value=true)
Set or clear bit at position in chunked bit array. 
Definition: bits.h:721
 
const Parent * parent() const
Get pointer to parent BitArray. 
Definition: bit_array.h:343
 
BitArrayT(const ThisType &src, Size pos, Size count=ALL)
Copy from another bit array. 
Definition: bit_array.h:948
 
bool readonly() const
Get whether subset is read-only, meaning writes will fail. 
Definition: bit_array.h:336
 
ThisType & operator=(const Parent &parent)
Assignment operator to reference a new parent as read-only. 
Definition: bit_array.h:208
 
static Size array_iter(IterState &state, const T *data, Size bitsize)
Iterate to first set bit in array. 
Definition: bits.h:641
 
bool checkall() const
Check if all bits are set in bit array (const). 
Definition: bit_array.h:1232
 
Bit array iteration state. 
Definition: bits.h:615
 
U extractr(Size pos=0, Size count=ALL) const
Extract bits from bit array. 
Definition: bit_array.h:1380
 
static void array_shiftr(T *data, Size bitsize, uint count)
Shift to the right in chunked bit array. 
Definition: bits.h:1210
 
~BitArrayT()
Destructor. 
Definition: bit_array.h:978
 
const ThisType & asconst() const
Explicitly use a const reference to this. 
Definition: bit_array.h:1023
 
ThisType & operator=(const ThisType &src)
Assignment operator to copy a subset, referencing the same parent. 
Definition: bit_array.h:196
 
BitArraySubsetT(Parent &parent, Size pos, Size count=ALL)
Constructor to reference a subset of parent BitArray. 
Definition: bit_array.h:160
 
ThisType & operator=(Parent &parent)
Assignment operator to reference a new parent. 
Definition: bit_array.h:220
 
static Size array_size(Size bitsize)
Calculate array size in chunks for number of bits. 
Definition: bits.h:396
 
bool shared() const
Get whether shared (false). 
Definition: bit_array.h:1164
 
TParent::Size Size
Size integer type. 
Definition: bit_array.h:127
 
BitArrayT()
Default constructor sets as null. 
Definition: bit_array.h:920
 
BitArraySubsetT(Parent &parent)
Constructor to reference a parent BitArray. 
Definition: bit_array.h:143
 
Dynamic bit array container with similar interface to Array and List. 
Definition: bit_array.h:900
 
BitArrayT(Size bitsize)
Constructor create bit array. 
Definition: bit_array.h:926
 
Traits and helpers for bit manipulation. 
Definition: bits.h:309
 
Size size_pow2(Size size, Size minsize=2)
Get size as power of 2. 
Definition: type.h:1951
 
bool operator[](Size pos) const
Get bit at position in subset (const). 
Definition: bit_array.h:363
 
Iter cbegin() const
Get iterator at first item (const). 
Definition: bit_array.h:1199
 
static bool array_checkany(const T *data, Size bitsize)
Check if any bits are set in bit array. 
Definition: bits.h:555