|
Evo C++ Library v0.5.1
|
#include <evo/bit_array.h>
A subset of a BitArray.
C++11:
Note that this is not a full EvoContainer and doesn't have any iterators.
Output:
Public Types | |
| typedef TParent | Parent |
| Parent BitArray type. More... | |
| typedef TParent::Size | Size |
| Size integer type. More... | |
| typedef BitArraySubsetT< TParent > | ThisType |
| This BitArraySubset type. More... | |
| typedef TParent::Value | Value |
| Chunk value type. More... | |
Public Member Functions | |
| BitArraySubsetT () | |
| Constructor sets as null. More... | |
| BitArraySubsetT (const Parent &parent) | |
| Constructor to reference a parent BitArray as read-only. More... | |
| BitArraySubsetT (Parent &parent) | |
| Constructor to reference a parent BitArray. More... | |
| BitArraySubsetT (const Parent &parent, Size pos, Size count=ALL) | |
| Constructor to reference a subset of parent BitArray as read-only. More... | |
| BitArraySubsetT (Parent &parent, Size pos, Size count=ALL) | |
| Constructor to reference a subset of parent BitArray. More... | |
| BitArraySubsetT (const ThisType &src) | |
| Copy constructor to reference the same parent and subset. More... | |
| BitArraySubsetT (ThisType &&src) | |
| Move constructor (C++11). More... | |
| Size | checkall () const |
| Check if all bits are set in subset (const). More... | |
| bool | checkany () const |
| Check if any bits are set in subset (const). More... | |
| bool | clearbit (Size pos) |
| Clear bit at position in subset. More... | |
| Size | clearbits (Size pos=0, Size count=ALL) const |
| Clear count bits at position in subset. More... | |
| Size | countbits (bool value=true) const |
| Count number of bits set or cleared in subset (const). More... | |
| bool | empty () const |
| Get whether empty. More... | |
| template<class U = ulong> | |
| U | extractl (Size pos=0, Size count=ALL) const |
| Extract bits from subset. More... | |
| template<class U = ulong> | |
| U | extractr (Size pos=0, Size count=ALL) const |
| Extract bits from subset. More... | |
| template<class U > | |
| bool | format (U &out, int base=fBIN) |
| Format bits from subset to stream or string using base. More... | |
| bool | getbit (Size pos) const |
| Get bit at position in subset (const). More... | |
| bool | null () const |
| Get whether null. More... | |
| Size | offset () const |
| Get subset offset position in parent. More... | |
| bool | operator!= (const ThisType &data) const |
| Inequality operator. More... | |
| ThisType & | operator= (ThisType &&src) |
| Move assignment operator (C++11). More... | |
| ThisType & | operator= (const ThisType &src) |
| Assignment operator to copy a subset, referencing the same parent. More... | |
| ThisType & | operator= (const Parent &parent) |
| Assignment operator to reference a new parent as read-only. More... | |
| ThisType & | operator= (Parent &parent) |
| Assignment operator to reference a new parent. More... | |
| bool | operator== (const ThisType &data) const |
| Equality operator. More... | |
| bool | operator[] (Size pos) const |
| Get bit at position in subset (const). More... | |
| const Parent * | parent () const |
| Get pointer to parent BitArray. More... | |
| Parent * | parent_nonconst () |
| Get non-const pointer to parent BitArray. More... | |
| bool | readonly () const |
| Get whether subset is read-only, meaning writes will fail. More... | |
| ThisType & | set () |
| Set as null. More... | |
| ThisType & | set (const ThisType &src, Size pos=0, Size count=ALL) |
| Set as subset of another subset. More... | |
| ThisType & | set (const Parent &parent, Size pos=0, Size count=ALL) |
| Set as read-only subset of BitArray. More... | |
| ThisType & | set (Parent &parent, Size pos=0, Size count=ALL) |
| Set as subset of BitArray. More... | |
| bool | setbit (Size pos, bool value=true) |
| Set or clear bit at position in subset. More... | |
| Size | setbits (Size pos=0, Size count=ALL, bool value=true) |
| Set or clear count bits at position in subset. More... | |
| Size | size () const |
| Get size as number of bits in subset. More... | |
| template<class U > | |
| bool | store (Size pos, Size count, U value) |
| Stores bits from value in subset. More... | |
| bool | togglebit (Size pos) |
| Toggle bit at position in subset. More... | |
| Size | togglebits (Size pos=0, uint count=ALL) |
| Toggle count bits at position in subset. More... | |
| typedef TParent Parent |
Parent BitArray type.
| typedef TParent::Size Size |
Size integer type.
| typedef BitArraySubsetT<TParent> ThisType |
This BitArraySubset type.
| typedef TParent::Value Value |
Chunk value type.
|
inline |
Constructor sets as null.
|
inline |
Constructor to reference a parent BitArray as read-only.
| parent | Parent to reference (const) |
|
inline |
Constructor to reference a parent BitArray.
| parent | Parent to reference |
|
inline |
Constructor to reference a subset of parent BitArray as read-only.
| parent | Parent to reference (const) |
| pos | Bit posiiton in parent for subset |
| count | Number of bits in parent for subset |
|
inline |
Constructor to reference a subset of parent BitArray.
| parent | Parent to reference |
| pos | Bit posiiton in parent for subset |
| count | Number of bits in parent for subset |
|
inline |
Copy constructor to reference the same parent and subset.
| src | Subset to copy from |
|
inline |
Move constructor (C++11).
| src | Source to move |
|
inline |
Check if all bits are set in subset (const).
|
inline |
Check if any bits are set in subset (const).
|
inline |
Clear bit at position in subset.
| pos | Bit position in subset to clear, 0 for first bit on left, etc |
pos out of bounds Clear count bits at position in subset.
| pos | Bit position in subset to clear, 0 for first bit on left, etc |
| count | Number of bits to clear from pos, ALL for all from pos in subset |
|
inline |
Count number of bits set or cleared in subset (const).
| value | Whether to count bits set, false to count cleared bits (not set) |
|
inline |
Extract bits from subset.
111 returned as uint8: 11100000| U | Return type for extracted bits, must be unsigned (uint, ulong, uint32, etc) – defaults to ulong in C++11 or newer |
| pos | Bit position to extract from, 0 for first bit on left, etc |
| count | Number of bits to extract, truncated if larger than bitsize or return value |
Extract bits from subset.
111 returned as uint8: 00000111 or 7 in decimalcount larger than bits in return type will be truncated – this should be avoided as it may not be easy to tell how many bits were truncatedcount=9 with return type uint8 then this uses count=8count may go out of bit array bounds without truncation – bits from out of bounds are set to 0 and still are right-aligned according to count| U | Return type for extracted bits, must be unsigned (uint, ulong, uint32, etc) – defaults to ulong in C++11 or newer |
| pos | Bit position to extract from, 0 for first bit on left, etc |
| count | Number of bits to extract, ALL for num bits in return type, truncated if larger than bits in return type |
|
inline |
Format bits from subset to stream or string using base.
8, or 5 set bits formatted as hex is F8| U | Output string/stream type, deduced from arguments |
| out | Output string or stream (or associated Format object) to format to |
| base | Base to format as, must be a power of 2 between 2-32 (inclusive), add 100 for lowercase letters, or use enum:
|
|
inline |
Get bit at position in subset (const).
| pos | Bit position in subset to get, 0 for first bit on left, etc |
pos is out of bounds
|
inline |
Get whether null.
|
inline |
Get subset offset position in parent.
|
inline |
Inequality operator.
| data | Subset to compare to |
Move assignment operator (C++11).
| src | Source to move |
Assignment operator to copy a subset, referencing the same parent.
| src | Subset to copy from |
Assignment operator to reference a new parent as read-only.
| parent | Parent to reference (const) |
Assignment operator to reference a new parent.
| parent | Parent to reference |
|
inline |
Equality operator.
| data | Subset to compare to |
|
inline |
|
inline |
Get pointer to parent BitArray.
|
inline |
Get non-const pointer to parent BitArray.
|
inline |
Get whether subset is read-only, meaning writes will fail.
|
inline |
Set as null.
Set as subset of another subset.
| src | Subset to copy from |
| pos | Bit position for subset of subset |
| count | Number of bits for subset of subset |
Set as read-only subset of BitArray.
| parent | Parent to reference (const) |
| pos | Bit posiiton in parent for subset |
| count | Number of bits in parent for subset |
Set as subset of BitArray.
| parent | Parent to reference |
| pos | Bit posiiton in parent for subset |
| count | Number of bits in parent for subset |
|
inline |
Set or clear bit at position in subset.
| pos | Bit position in subset to set, 0 for first bit on left, etc |
| value | Bit value to set, true to set bit, false to clear bit |
pos out of bounds Set or clear count bits at position in subset.
| pos | Bit position in subset to set, 0 for first bit on left, etc |
| count | Number of bits to set from pos, ALL for all from pos in subset |
| value | Bit value to set, true to set bits, false to clear bits |
|
inline |
Get size as number of bits in subset.
Stores bits from value in subset.
00000111 with count=3 would store 111 (3 right-most bits) or 7 in decimalvalue size, count is capped at that size – only bits from value are stored| U | Value type to store, signed value is treated as unsigned – inferred from value param |
| pos | Bit position in subset to store at, 0 for first bit on left, etc |
| count | Number of bits to store from value |
| value | Value to store (count right-most bits are stored) |
pos is out of bounds
|
inline |
Toggle bit at position in subset.
| pos | Bit position in subset to toggle, 0 for first bit on left, etc |
pos out of bounds Toggle count bits at position in subset.
| pos | Bit position in subset to toggle, 0 for first bit on left, etc |
| count | Number of bits to toggle from pos, ALL for all from pos in subset |
1.8.13