|
Yate
|
A slice vector holding bits. More...
#include <yatemath.h>
Additional Inherited Members | |
Static Public Member Functions inherited from SliceVector< Obj > | |
| static unsigned int | objSize () |
| static unsigned int | size (unsigned int len) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Protected Member Functions inherited from SliceVector< Obj > | |
| Obj * | end (Obj *start, unsigned int len) |
| const Obj * | end (const Obj *start, unsigned int len) const |
| bool | setData (Obj *data=0, unsigned int len=0, unsigned int maxLen=0) |
| bool | initStorage (unsigned int len, const Obj *data=0, unsigned int maxLen=0) |
| bool | initSlice (bool del, const SliceVector &other, unsigned int offs=0, unsigned int len=0) |
Protected Attributes inherited from SliceVector< Obj > | |
| RefStorage * | m_storage |
| Obj * | m_data |
| unsigned int | m_length |
| unsigned int | m_maxLen |
A slice vector holding bits.
This vector holds bit values using 1 byte. It implements methods operating on bits. NOTE: The array indexing operator allows setting invalid values (not 1 or 0). The pack/unpack methods are safe (they will handle non 0 values as bit 1). The comparison operators may fail for vectors containing values other than 0 or 1.
|
inline |
Constructor
Referenced by BitVector::slice(), and BitVector::tail().
Copy constructor. Builds a slice of another vector
| other | Original vector |
Constructor. Build the vector storage
| len | Length of data |
| maxLen | Optional vector maximum length (it will be adjusted to be at least len) |
Constructor. Builds a slice of another vector
| other | Original vector |
| offs | Offset in the original vector |
| len | The number of elements (0 to use all available from offset) |
Constructor. Build from string bits
| str | String bits ('1' -> 1, else -> 0) |
| maxLen | Optional vector maximum length |
Append bits to string
| buf | Destination string |
| offs | Optional starting index |
| len | The number of elements to be added (negative to add all) |
Referenced by BitVector::toString().
| bool get | ( | FloatVector & | dest | ) | const |
Set float bit values from this vector (0 -> 0.0F, non 0 -> 1.0F). The destination vector will be resized to this vector's length
| dest | The destination vector |
Retrieve vector head
| dest | Destination vector |
| len | The number of elements to retrieve |
References BitVector::slice().
Retrieve vector head
| len | The number of elements to retrieve |
References BitVector::slice().
| bool pack | ( | ByteVector & | dest | ) | const |
Pack bits into a ByteVector (LSB source to MSB in destination). MSB of first byte in destination will have the same value of the first bit in this vector. Remaining elements in destination are left untouched
| dest | Destination vector |
Pack up to 64 bits, LSB-first (i.e. first bit goes to LSB in destination)
| offs | The start offset |
| len | The number of elements to be packed (-1 to pack all available). No more than 64 bits will be packed |
| bool set | ( | const FloatVector & | input | ) |
Initializes this vector from float values (0.0F -> 0, non 0 -> 1). The vector will be resized to input length
| input | The input vector |
Set a slice containing another vector
| other | Original vector |
| offs | Offset in the original vector |
| len | The number of elements (0 to use all available from offset) |
Set a slice of this vector to another one. The destination vector will be changed
| dest | Destination vector |
| offs | Offset in our vector |
| len | The number of elements (0 to use all available from offset) |
Retrieve a vector slice
| offs | Offset in our vector |
| len | The number of elements to retrieve |
References BitVector::BitVector().
Referenced by BitVector::head(), and BitVector::head().
Retrieve vector tail (last elements)
| len | The number of elements to retrieve |
| dest | Destination vector |
References SliceVector< Obj >::length().
Retrieve vector tail (last elements)
| len | The number of elements to retrieve |
References BitVector::BitVector(), and SliceVector< Obj >::length().
Build a String from vector bits and return it
| offs | Optional starting index |
| len | The number of elements to be added (negative to add all) |
References BitVector::appendTo(), and SliceVector< Obj >::SliceVector().
| bool unpack | ( | const ByteVector & | src | ) |
Unpack a ByteVector into this BitVector. MSB of the first element in source goes to first bit in this vector. Remaining bits are left untouched
| src | Source byte vector |
Unpack up to 64 bits into this vector, LSB first
| value | Value to unpack |
| offs | Optional start offset |
| len | The number of bits to unpack |
Unpack up to 32 bits into this vector (MSB to LSB). MSB from value is the first unpacked bit
| value | The value to be unpacked |
| offs | Optional start offset |
| len | The number of bits to unpack |
Referenced by BitVector::unpackMsb16().
Unpack up to 16 bits into this vector (MSB to LSB). MSB from value is the first unpacked bit
| value | The value to be unpacked |
| offs | Optional start offset |
| len | The number of bits to unpack |
References BitVector::unpackMsb().
| bool valid | ( | ) | const |
Check if this vector contains valid values (0 or 1)
Apply XOR on vector elements using a given value's bits, MSB first. Given v31,v30,...,v0 the value's bits in MSB order the result will be data()[offs] ^= v31, data()[offs+1] ^= v30 ...
| value | Value to use |
| offs | Start position in this BitVector |
| len | The number of bits to use |
Referenced by BitVector::xorMsb16().
Apply XOR on vector elements using a given value's bits, MSB first. Given v15,v14,...,v0 the value's bits in MSB order the result will be data()[offs] ^= v15, data()[offs+1] ^= v14 ...
| value | Value to use |
| offs | Start position in this BitVector |
| len | The number of bits to use |
References BitVector::xorMsb().