An extended Bitset ( BitsetExt ) for handling e.g. Hamming encoding/decoding. More...
#include <Bitset.h>
Public Member Functions | |
BitsetExt () | |
Constructor. More... | |
BitsetExt (bool _verbose) | |
Constructor. More... | |
int | hamming_dec (int block_len) |
Hamming decoding 'in-place' using the defined block length. More... | |
void | hamming_enc (int block_len) |
Hamming encoding 'in-place' using the defined block length. More... | |
void | SetVerbose (bool _verbose) |
Set the verbose/silent mode. More... | |
Public Member Functions inherited from alvar::Bitset | |
void | clear () |
Clear the bits. More... | |
void | fill_zeros_left (const size_t bit_count) |
Fill the Bitset with non-meaningful zeros. More... | |
void | flip (size_t pos) |
Flip the selected bit. More... | |
std::deque< bool > & | GetBits () |
The Bitset as 'deque<bool>'. More... | |
std::string | hex () |
The Bitset as a hex string. More... | |
int | Length () |
The length of the Bitset. More... | |
std::ostream & | Output (std::ostream &os) const |
Output the bits to selected ostream. More... | |
bool | pop_back () |
Pop the back bit. More... | |
bool | pop_front () |
Pop the front bit. More... | |
void | push_back (const bool bit) |
Push back one bit. More... | |
void | push_back (const unsigned char b, const int bit_count=8) |
Push back bit_count bits from 'byte' b. More... | |
void | push_back (const unsigned short s, const int bit_count=16) |
Push back bit_count bits from 'short' s. More... | |
void | push_back (const unsigned long l, const int bit_count=32) |
Push back bit_count bits from 'long' l. More... | |
void | push_back (std::string s) |
Push back a string of characters. More... | |
void | push_back_meaningful (const unsigned long l) |
Push back meaningful bits from 'long' l. More... | |
unsigned char | uchar () |
The Bitset as 'unsigned char'. More... | |
unsigned long | ulong () |
The Bitset as 'unsigned long'. More... | |
Static Public Member Functions | |
static int | count_hamming_dec_len (int block_len, int enc_len) |
Count how many bits will be in the Bitset after hamming decoding. More... | |
static int | count_hamming_enc_len (int block_len, int dec_len) |
Count how many bits will be in the Bitset after hamming encoding. More... | |
Protected Member Functions | |
int | hamming_dec_block (unsigned long block_len, std::deque< bool >::iterator &iter) |
void | hamming_enc_block (unsigned long block_len, std::deque< bool >::iterator &iter) |
Protected Attributes | |
bool | verbose |
Protected Attributes inherited from alvar::Bitset | |
std::deque< bool > | bits |
An extended Bitset ( BitsetExt ) for handling e.g. Hamming encoding/decoding.
This class is based on the basic Bitset. It provides additional features for Hamming coding (See http://en.wikipedia.org/wiki/Hamming_code).
The BitsetExt is used e.g by MarkerData
alvar::BitsetExt::BitsetExt | ( | ) |
Constructor.
Definition at line 254 of file Bitset.cpp.
alvar::BitsetExt::BitsetExt | ( | bool | _verbose | ) |
Constructor.
Definition at line 257 of file Bitset.cpp.
|
static |
Count how many bits will be in the Bitset after hamming decoding.
Definition at line 295 of file Bitset.cpp.
|
static |
Count how many bits will be in the Bitset after hamming encoding.
Definition at line 278 of file Bitset.cpp.
int alvar::BitsetExt::hamming_dec | ( | int | block_len | ) |
Hamming decoding 'in-place' using the defined block length.
Definition at line 319 of file Bitset.cpp.
|
protected |
Definition at line 188 of file Bitset.cpp.
void alvar::BitsetExt::hamming_enc | ( | int | block_len | ) |
Hamming encoding 'in-place' using the defined block length.
Definition at line 312 of file Bitset.cpp.
|
protected |
Definition at line 142 of file Bitset.cpp.
void alvar::BitsetExt::SetVerbose | ( | bool | _verbose | ) |
Set the verbose/silent mode.
Definition at line 275 of file Bitset.cpp.