Bitset is a basic class for handling bit sequences
More...
#include <Bitset.h>
Bitset is a basic class for handling bit sequences
The bits are stored internally using deque<bool> (See http://osdir.com/ml/gis.geos.devel/2006-04/msg00142.html). The bitset is assumed to have most significant bits left i.e. the push_back() methods add to the least significant end of the bit sequence. The usage is clarified by the following example.
Usage
Bitset b;
b.push_back(true);
b.push_back(false);
b.push_back(false);
b.push_back(false);
b.push_back(8, 4);
b.push_back(0x88, 8);
b.fill_zeros_left(32);
b.Output(std::cout);
Definition at line 63 of file Bitset.h.
◆ fill_zeros_left()
void fill_zeros_left |
( |
const size_t |
bit_count | ) |
|
Fill the Bitset with non-meaningful zeros.
- Parameters
-
bit_count | Non-meaningful zeros are added until this given bit_count is reached. |
◆ flip()
Flip the selected bit.
- Parameters
-
pos | The bit in this given position is flipped. |
◆ Output()
std::ostream& Output |
( |
std::ostream & |
os | ) |
const |
Output the bits to selected ostream.
- Parameters
-
os | The output stream to be used for outputting e.g. std::cout |
◆ push_back() [1/5]
void push_back |
( |
const bool |
bit | ) |
|
Push back one bit.
- Parameters
-
bit | Boolean (true/false) to be pushed to the end of bit sequence. |
◆ push_back() [2/5]
void push_back |
( |
const unsigned char |
b, |
|
|
const int |
bit_count = 8 |
|
) |
| |
Push back bit_count bits from 'byte' b.
- Parameters
-
b | Unsigned character (8-bits) to be pushed to the end of bit sequence. |
bit_count | Number of bits to be pushed (default/max is 8 bits) |
◆ push_back() [3/5]
void push_back |
( |
const unsigned long |
l, |
|
|
const int |
bit_count = 32 |
|
) |
| |
Push back bit_count bits from 'long' l.
- Parameters
-
l | Unsigned long (32-bits) to be pushed to the end of bit sequence. |
bit_count | Number of bits to be pushed (default/max is 32 bits) |
◆ push_back() [4/5]
void push_back |
( |
const unsigned short |
s, |
|
|
const int |
bit_count = 16 |
|
) |
| |
Push back bit_count bits from 'short' s.
- Parameters
-
s | Unsigned short (16-bits) to be pushed to the end of bit sequence. |
bit_count | Number of bits to be pushed (default/max is 16 bits) |
◆ push_back() [5/5]
void push_back |
( |
std::string |
s | ) |
|
Push back a string of characters.
- Parameters
-
s | String of characters to be pushed to the end of bit sequence. |
◆ push_back_meaningful()
void push_back_meaningful |
( |
const unsigned long |
l | ) |
|
Push back meaningful bits from 'long' l.
- Parameters
-
l | The meaningful bits of the given unsigned long (32-bits) are pushed to the end of bit sequence. |
The documentation for this class was generated from the following file: