![]() |
My Project
|
An extended Bitset ( BitsetExt ) for handling e.g. Hamming encoding/decoding. More...
#include <Bitset.h>
Public Member Functions | |
BitsetExt () | |
Constructor. | |
BitsetExt (bool _verbose) | |
Constructor. | |
void | SetVerbose (bool _verbose) |
Set the verbose/silent mode. | |
void | hamming_enc (int block_len) |
Hamming encoding 'in-place' using the defined block length. | |
int | hamming_dec (int block_len) |
Hamming decoding 'in-place' using the defined block length. | |
![]() | |
int | Length () |
The length of the Bitset. | |
std::ostream & | Output (std::ostream &os) const |
Output the bits to selected ostream. More... | |
void | clear () |
Clear the bits. | |
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_meaningful (const unsigned long l) |
Push back meaningful bits from 'long' l. More... | |
void | fill_zeros_left (const size_t bit_count) |
Fill the Bitset with non-meaningful zeros. More... | |
void | push_back (std::string s) |
Push back a string of characters. More... | |
bool | pop_front () |
Pop the front bit. | |
bool | pop_back () |
Pop the back bit. | |
void | flip (size_t pos) |
Flip the selected bit. More... | |
std::string | hex () |
The Bitset as a hex string. | |
unsigned long | ulong () |
The Bitset as 'unsigned long'. | |
unsigned char | uchar () |
The Bitset as 'unsigned char'. | |
std::deque< bool > & | GetBits () |
The Bitset as 'deque<bool>'. | |
Static Public Member Functions | |
static int | count_hamming_enc_len (int block_len, int dec_len) |
Count how many bits will be in the Bitset after hamming encoding. | |
static int | count_hamming_dec_len (int block_len, int enc_len) |
Count how many bits will be in the Bitset after hamming decoding. | |
Protected Member Functions | |
void | hamming_enc_block (unsigned long block_len, std::deque< bool >::iterator &iter) |
int | hamming_dec_block (unsigned long block_len, std::deque< bool >::iterator &iter) |
Protected Attributes | |
bool | verbose |
![]() | |
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