#include <PhxBitVector.h>
Public Types | |
| typedef uint32_t | Bits |
| typedef uint32_t | Bytes |
Public Member Functions | |
| BitVector (Bits bitCount=16) | |
| BitVector (const uint8_t *buffer, Bits bitCount) | |
| BitVector (const BitVector &) | |
| const BitVector & | operator= (const BitVector &) |
| uint8_t * | data () |
| Returns a pointer to this vector's raw data. | |
| const uint8_t * | data () const |
| Bits | bitCount () const |
| The number of valid bits in this BitVector. | |
| void | bitCount (Bits bitCount) |
| Sets the bit count attribute. | |
| Bytes | byteCount (void) const |
| The number of valid bytes in this BitVector. | |
| Bytes | dataSize (void) const |
| The size of the data() buffer in bytes. | |
| void | dataSize (Bytes dataSize) |
| Sets the size of this BitVector's data() buffer. | |
| String | stringField (Bits bitIndex) const |
| Reads a String starting from the given index. | |
| double | doubleField (Bits bitIndex) const |
| Reads a double starting from the given index. | |
| float | floatField (Bits bitIndex) const |
| Reads a float starting from the given index. | |
| uint64_t | uint64Field (Bits bitIndex) const |
| Reads a uint64_t starting from the given index. | |
| uint32_t | uint32Field (Bits bitIndex) const |
| Reads a uint32_t starting from the given index. | |
| uint16_t | uint16Field (Bits bitIndex) const |
| Reads a uint16_t starting from the given index. | |
| uint8_t | uint8Field (Bits bitIndex) const |
| Reads a uint8_t starting from the given index. | |
| int64_t | int64Field (Bits bitIndex) const |
| Reads an int64_t starting from the given index. | |
| int32_t | int32Field (Bits bitIndex) const |
| Reads an int32_t starting from the given index. | |
| int16_t | int16Field (Bits bitIndex) const |
| Reads an int16_t starting from the given index. | |
| int8_t | int8Field (Bits bitIndex) const |
| Reads a int8_t starting from the given index. | |
| bool | boolField (Bits bitIndex) const |
| Reads an unsigned integer with a specified number of bits. Reads a signed integer with a specified number of bits. Reads a boolean from the given index. | |
| void | stringField (Bits bitIndex, const String &value) |
| Reads a BitVector starting from the given index. | |
| void | doubleField (Bits bitIndex, double value) |
| void | floatField (Bits bitIndex, float value) |
| void | uint64Field (Bits bitIndex, uint64_t value) |
| void | uint32Field (Bits bitIndex, uint32_t value) |
| void | uint16Field (Bits bitIndex, uint16_t value) |
| void | uint8Field (Bits bitIndex, uint8_t value) |
| void | int64Field (Bits bitIndex, int64_t value) |
| void | int32Field (Bits bitIndex, int32_t value) |
| void | int16Field (Bits bitIndex, int16_t value) |
| void | int8Field (Bits bitIndex, int8_t value) |
| void | boolField (Bits bitIndex, bool value) |
Classes | |
| class | InputFile |
| Represents a file from which BitVector's can be read. More... | |
| class | InputStream |
| A wrapper to BitVector that provides stream-style input (reading) semantics. More... | |
| class | OutputFile |
| Represents a file to which BitVector's can be stored. More... | |
| class | OutputStream |
| A wrapper to BitVector that provides stream-style output (writing) semantics. More... | |
You can read/write various primitive types to the bit vector directly indexing into the array, or you can use the InputStream and OutputStream types for stream-style access.
|
|
Sets the bit count attribute.
This will set the bitCount attribute to a specified value. If more storage is necessary to hold the specified number of bits, then dataSize() will be set to accomodate this. If the new value is smaller than the current value, then the count is simply set and dataSize() will not be modified. However, all bits beyond the first This will be used quite rarely by clients. It exists so that clients which provide raw data directly to the BitVector by copying it into the data() buffer may specify how many valid bits of data are now contained in the BitVector.
|
|
|
The number of valid bits in this BitVector. The allocated size of data() may be greater than necessary to contain these bits of data. However, any bits beyond the first bitCount() bits are zero.
|
|
|
Reads an unsigned integer with a specified number of bits. Reads a signed integer with a specified number of bits. Reads a boolean from the given index.
|
|
|
The number of valid bytes in this BitVector. This is simply bitCount(), rounded up to the nearest number of bytes.
|
|
|
Returns a pointer to this vector's raw data.
|
|
|
Sets the size of this BitVector's data() buffer. The buffer is guaranteed to be re-allocated to the given size (whether it is larger or smaller). The data will be truncated if necessary to do this (which will be reflected by the bitCount()) variable.
|
|
|
The size of the data() buffer in bytes. The actual number of valid (initialized) bits of data in the array may be less, as reported by bitCount(). The returned number here is the actual amount of memory allocated for the data() field, and hence is the maximum amount of raw data that could be copied into this BitVector from an external source.
|
|
|
Reads a double starting from the given index.
|
|
|
Reads a float starting from the given index.
|
|
|
Reads an int16_t starting from the given index.
|
|
|
Reads an int32_t starting from the given index.
|
|
|
Reads an int64_t starting from the given index.
|
|
|
Reads a int8_t starting from the given index.
|
|
||||||||||||
|
Reads a BitVector starting from the given index. Another vector of bits can be embedded within a BitVector as a means of encapsulating vectors generated by other sources. The length of the original vector is included in the encapsulated data so the length (in bits) of the original vector is preserved.
|
|
|
Reads a String starting from the given index.
|
|
|
Reads a uint16_t starting from the given index.
|
|
|
Reads a uint32_t starting from the given index.
|
|
|
Reads a uint64_t starting from the given index.
|
|
|
Reads a uint8_t starting from the given index.
|
1.4.2