BitVector Class Reference

`#include <BitVector.h>`

Inheritance diagram for BitVector:

## Public Member Functions

Casts of Vector constructors.
| BitVector (VectorDataType wData, char *wStart, char *wEnd)
| BitVector (const BitVector &other)
| BitVector (size_t len)
| BitVector ()
| BitVector (const BitVector &other1, const BitVector &other2)
| BitVector (const char *valString)
Casts and overrides of Vector operators.
BitVector | segment (size_t start, size_t span)
const BitVector | cloneSegment (size_t start, size_t span) const
BitVector | alias () const
BitVector | head (size_t span)
BitVector | tail (size_t start)
void | zero ()
FEC operations.
uint64_t | syndrome (Generator &gen) const
uint64_t | parity (Generator &gen) const
void | invert ()
Byte-wise operations.
void | reverse8 ()
void | LSB8MSB ()
Public Member Functions inherited from VectorBase< char >
size_t | size () const
size_t | bytes () const
void | resize (size_t newElements)
void | clear ()
void | clone (const VectorBase< char > &other)
void | vConcat (const VectorBase< char > &other1, const VectorBase< char > &other2)
| ~VectorBase ()
bool | isOwner ()
std::string | inspect () const
void | copyToSegment (VectorBase< char > &other, size_t start, size_t span) const
void | copyToSegment (VectorBase< char > &other, size_t start=0) const
void | copyTo (VectorBase< char > &other) const
void | segmentCopyTo (VectorBase< char > &other, size_t start, size_t span) const
void | fill (const char &val)
void | fill (const char &val, unsigned start, unsigned length)
void | operator= (const VectorBase< char > &other)
char & | operator[] (size_t index)
const char & | operator[] (size_t index) const
const char * | begin () const
char * | begin ()
const char * | end () const
char * | end ()
const char * | getData () const

## Serialization and deserialization.

typedef char * | iterator
typedef const char * | const_iterator
uint64_t | peekField (size_t readIndex, unsigned length) const
uint64_t | peekFieldReversed (size_t readIndex, unsigned length) const
uint64_t | readField (size_t &readIndex, unsigned length) const
uint64_t | readFieldReversed (size_t &readIndex, unsigned length) const
void | fillField (size_t writeIndex, uint64_t value, unsigned length)
void | fillFieldReversed (size_t writeIndex, uint64_t value, unsigned length)
void | writeField (size_t &writeIndex, uint64_t value, unsigned length)
void | writeFieldReversed (size_t &writeIndex, uint64_t value, unsigned length)
void | write0 (size_t &writeIndex)
void | write1 (size_t &writeIndex)
unsigned | sum () const
void | map (const unsigned *map, size_t mapSize, BitVector &dest) const
void | unmap (const unsigned *map, size_t mapSize, BitVector &dest) const
void | pack (unsigned char *) const
void | pack2 (unsigned char *) const
std::string | packToString () const
void | unpack (const unsigned char *)
void | hex (std::ostream &) const
std::string | hexstr () const
bool | unhex (const char *)
void | dup (BitVector other)
void | dup (BitVector &other)
bool | operator== (const BitVector &other) const
void | copyPunctured (BitVector &dst, const unsigned *puncture, const size_t plth)
bool | bit (size_t index) const
char & | operator[] (size_t index)
const char & | operator[] (size_t index) const
void | settfb (size_t index, int value)

## Additional Inherited Members

Protected Types inherited from VectorBase< char >
typedef char * | VectorDataType
Protected Member Functions inherited from VectorBase< char >
void | vInit (size_t elements)
void | shiftMem (VectorBase< char > &other)
void | makeAlias (const VectorBase< char > &other)
| VectorBase ()
| VectorBase (VectorDataType wData, char *wStart, char *wEnd)
Protected Attributes inherited from VectorBase< char >
VectorDataType | mData
| allocated data block.
char * | mStart
| start of useful data
char * | mEnd
| end of useful data + 1

## Member Typedef Documentation

## const_iterator

typedef const char* BitVector::const_iterator

## iterator

typedef char* BitVector::iterator

## Constructor & Destructor Documentation

## BitVector() [1/6]

BitVector::BitVector | ( | VectorDataType | wData,
|  | char * | wStart,
|  | char * | wEnd
| ) |  |

inline

## BitVector() [2/6]

BitVector::BitVector | ( | const BitVector & | other | ) |

inline

References VectorBase< char >::clone(), VectorBase< T >::getData(), VectorBase< char >::makeAlias(), and VECTORDEBUG.

## BitVector() [3/6]

BitVector::BitVector | ( | size_t | len | ) |

inline explicit

References VectorBase< char >::vInit().

## BitVector() [4/6]

BitVector::BitVector | ( |  | ) |

inline

References VectorBase< char >::vInit().

Referenced by segment().

## BitVector() [5/6]

BitVector::BitVector | ( | const BitVector & | other1,
|  | const BitVector & | other2
| ) |  |

inline

Build a BitVector by concatenation.

References VectorBase< char >::getData(), and VectorBase< char >::vConcat().

## BitVector() [6/6]

BitVector::BitVector | ( | const char * | valString | ) |

Construct from a string of "0" and "1".

## Member Function Documentation

## alias()

BitVector BitVector::alias | ( |  | ) | const

inline

References segment(), and VectorBase< char >::size().

## bit()

bool BitVector::bit | ( | size_t | index | ) | const

inline

Index a single bit.

References VectorBase< char >::begin(), and VectorBase< char >::end().

## cloneSegment()

const BitVector BitVector::cloneSegment | ( | size_t | start,
|  | size_t | span
| ) |  | const

inline

References VectorBase< T >::clone(), and segment().

## copyPunctured()

void BitVector::copyPunctured | ( | BitVector & | dst,
|  | const unsigned * | puncture,
|  | const size_t | plth
| ) |  |

Copy to dst, not including those indexed in puncture.

## dup() [1/2]

void BitVector::dup | ( | BitVector & | other | ) |

inline

References VectorBase< char >::makeAlias(), VectorBase< T >::mStart, and VectorBase< char >::mStart.

## dup() [2/2]

void BitVector::dup | ( | BitVector | other | ) |

inline

References VectorBase< char >::getData(), VectorBase< char >::makeAlias(), VectorBase< T >::mStart, and VectorBase< char >::mStart.

## fillField()

void BitVector::fillField | ( | size_t | writeIndex,
|  | uint64_t | value,
|  | unsigned | length
| ) |  |

## fillFieldReversed()

void BitVector::fillFieldReversed | ( | size_t | writeIndex,
|  | uint64_t | value,
|  | unsigned | length
| ) |  |

## head()

BitVector BitVector::head | ( | size_t | span | ) |

inline

References segment().

## hex()

void BitVector::hex | ( | std::ostream & |  | ) | const

Make a hexdump string.

## hexstr()

std::string BitVector::hexstr | ( |  | ) | const

## invert()

void BitVector::invert | ( |  | ) |

Invert 0<->1.

## LSB8MSB()

void BitVector::LSB8MSB | ( |  | ) |

Reverse groups of 8 within the vector (byte reversal).

## map()

void BitVector::map | ( | const unsigned * | map,
|  | size_t | mapSize,
|  | BitVector & | dest
| ) |  | const

Reorder bits, dest[i] = this[map[i]].

## operator==()

bool BitVector::operator== | ( | const BitVector & | other | ) | const

## operator[]() [1/2]

char & BitVector::operator[] | ( | size_t | index | ) |

inline

References VectorBase< char >::mEnd, and VectorBase< char >::mStart.

## operator[]() [2/2]

const char & BitVector::operator[] | ( | size_t | index | ) | const

inline

References VectorBase< char >::mEnd, and VectorBase< char >::mStart.

## pack()

void BitVector::pack | ( | unsigned char * |  | ) | const

Pack into a char array.

## pack2()

void BitVector::pack2 | ( | unsigned char * |  | ) | const

## packToString()

std::string BitVector::packToString | ( |  | ) | const

## parity()

uint64_t BitVector::parity | ( | Generator & | gen | ) | const

Calculate the parity word for the vector with the given Generator.

## peekField()

uint64_t BitVector::peekField | ( | size_t | readIndex,
|  | unsigned | length
| ) |  | const

## peekFieldReversed()

uint64_t BitVector::peekFieldReversed | ( | size_t | readIndex,
|  | unsigned | length
| ) |  | const

## readField()

uint64_t BitVector::readField | ( | size_t & | readIndex,
|  | unsigned | length
| ) |  | const

## readFieldReversed()

uint64_t BitVector::readFieldReversed | ( | size_t & | readIndex,
|  | unsigned | length
| ) |  | const

## reverse8()

void BitVector::reverse8 | ( |  | ) |

Reverse an 8-bit vector.

## segment()

BitVector BitVector::segment | ( | size_t | start,
|  | size_t | span
| ) |  |

inline

References VectorBase< char >::begin(), BitVector(), VectorBase< char >::end(), and VectorBase< char >::mData.

Referenced by alias(), cloneSegment(), head(), and tail().

## settfb()

void BitVector::settfb | ( | size_t | index,
|  | int | value
| ) |  |

inline

Set a bit

References VectorBase< char >::mEnd, and VectorBase< char >::mStart.

## sum()

unsigned BitVector::sum | ( |  | ) | const

Sum of bits.

## syndrome()

uint64_t BitVector::syndrome | ( | Generator & | gen | ) | const

Calculate the syndrome of the vector with the given Generator.

## tail()

BitVector BitVector::tail | ( | size_t | start | ) |

inline

References segment(), and VectorBase< char >::size().

## unhex()

bool BitVector::unhex | ( | const char * |  | ) |

Unpack from a hexdump string.

Returns
  true on success, false on error.

## unmap()

void BitVector::unmap | ( | const unsigned * | map,
|  | size_t | mapSize,
|  | BitVector & | dest
| ) |  | const

Reorder bits, dest[map[i]] = this[i].

## unpack()

void BitVector::unpack | ( | const unsigned char * |  | ) |

Unpack from a char array.

## write0()

void BitVector::write0 | ( | size_t & | writeIndex | ) |

inline

References writeField().

## write1()

void BitVector::write1 | ( | size_t & | writeIndex | ) |

inline

References writeField().

## writeField()

void BitVector::writeField | ( | size_t & | writeIndex,
|  | uint64_t | value,
|  | unsigned | length
| ) |  |

Referenced by write0(), and write1().

## writeFieldReversed()

void BitVector::writeFieldReversed | ( | size_t & | writeIndex,
|  | uint64_t | value,
|  | unsigned | length
| ) |  |

## zero()

void BitVector::zero | ( |  | ) |

inline

References VectorBase< char >::fill().

The documentation for this class was generated from the following file:

- BitVector.h