An array of bits.
More...
#include <Serialize.h>
|
| BitArray (size_t size) |
|
| BitArray (uint8_t const *&in, size_t &size) |
|
bool | get (size_t index) const |
| Returns the value of the bit at the given index.
|
|
void | set (size_t index, bool value=true) |
| Sets the value of the bit at the given index. More...
|
|
void | reset (size_t index) |
| Sets the value of the bit at the given index to false. More...
|
|
void | flip (size_t index) |
| Flips the value of the bit at the given index. More...
|
|
bool | operator[] (size_t index) const |
| Returns the value of the bit at the given index. More...
|
|
|
virtual void | serialize (std::vector< uint8_t > &out) const override |
|
virtual json | toJson () const override |
|
An array of bits.
This is primarily used for serialization of an array of bits along with the number of bits in the array.
- See also
- VASize, VarArray
P2p::BitArray::BitArray |
( |
size_t |
size | ) |
|
|
inline |
- Parameters
-
size | Size of the array in bits |
P2p::BitArray::BitArray |
( |
uint8_t const *& |
in, |
|
|
size_t & |
size |
|
) |
| |
- Parameters
-
[in,out] | in | pointer to the next byte to deserialize |
[in,out] | size | number of bytes remaining in the serialized stream |
void P2p::BitArray::flip |
( |
size_t |
index | ) |
|
|
inline |
Flips the value of the bit at the given index.
- Parameters
-
bool P2p::BitArray::operator[] |
( |
size_t |
index | ) |
const |
|
inline |
Returns the value of the bit at the given index.
- Parameters
-
void P2p::BitArray::reset |
( |
size_t |
index | ) |
|
|
inline |
Sets the value of the bit at the given index to false.
- Parameters
-
void P2p::BitArray::set |
( |
size_t |
index, |
|
|
bool |
value = true |
|
) |
| |
Sets the value of the bit at the given index.
- Parameters
-
index | Which bit to set |
value | Value to set the bit to (defaults to true) |
The documentation for this class was generated from the following files: