MySQL 9.0.0
Source Code Documentation
Bitset Class Reference

A simple bitset wrapper class, whose size can be specified after the object has been defined. More...

#include <ut0bitset.h>

Public Member Functions

 Bitset ()
 Constructor. More...
 
 ~Bitset ()=default
 Destructor. More...
 
void init (byte *bitset, size_t size)
 Initialize the bitset with a byte array and size. More...
 
void copy (const byte *bitset, size_t size)
 Copy a byte array and size to current bitmap. More...
 
void set (size_t pos, bool v=true)
 Set the specified bit to the value 'bit'. More...
 
void set ()
 Set all bits to true. More...
 
void reset ()
 Set all bits to false. More...
 
bool test (size_t pos) const
 Test if the specified bit is set or not. More...
 
size_t size () const
 Get the size of current bitset. More...
 
size_t capacity () const
 Get the capacity of current bitset. More...
 
const bytebitset () const
 Get the bitset, don't allow to modify it! More...
 
Bitsetoperator= (const Bitset &from)
 Set current bitset with specified one. More...
 

Private Attributes

bytem_bitset
 Bitset bytes. More...
 
size_t m_size
 Bitset size in bytes. More...
 
size_t m_capacity
 Bitset capacity, could be bigger than m_size if one smaller bitmap has been assigned to it, after a copy() called. More...
 

Detailed Description

A simple bitset wrapper class, whose size can be specified after the object has been defined.

Constructor & Destructor Documentation

◆ Bitset()

Bitset::Bitset ( )
inline

Constructor.

◆ ~Bitset()

Bitset::~Bitset ( )
default

Destructor.

Member Function Documentation

◆ bitset()

const byte * Bitset::bitset ( ) const
inline

Get the bitset, don't allow to modify it!

Returns
current bitset

◆ capacity()

size_t Bitset::capacity ( ) const
inline

Get the capacity of current bitset.

Returns
the capacity of the bitset

◆ copy()

void Bitset::copy ( const byte bitset,
size_t  size 
)
inline

Copy a byte array and size to current bitmap.

Parameters
[in]bitsetbyte array for this bitset
[in]sizesize of the byte array

◆ init()

void Bitset::init ( byte bitset,
size_t  size 
)
inline

Initialize the bitset with a byte array and size.

Parameters
[in]bitsetbyte array for this bitset
[in]sizesize of the byte array

◆ operator=()

Bitset & Bitset::operator= ( const Bitset from)
inline

Set current bitset with specified one.

Current bitset should have called init() to allocate its own bitmap memory which should be big enough for the assignment.

Parameters
[in]fromset the bitset from this one
Returns
current bitset object

◆ reset()

void Bitset::reset ( void  )
inline

Set all bits to false.

◆ set() [1/2]

void Bitset::set ( )
inline

Set all bits to true.

◆ set() [2/2]

void Bitset::set ( size_t  pos,
bool  v = true 
)
inline

Set the specified bit to the value 'bit'.

Parameters
[in]posspecified bit
[in]vtrue or false

◆ size()

size_t Bitset::size ( ) const
inline

Get the size of current bitset.

Returns
the size of the bitset

◆ test()

bool Bitset::test ( size_t  pos) const
inline

Test if the specified bit is set or not.

Parameters
[in]posthe specified bit
Returns
True if this bit is set, otherwise false

Member Data Documentation

◆ m_bitset

byte* Bitset::m_bitset
private

Bitset bytes.

◆ m_capacity

size_t Bitset::m_capacity
private

Bitset capacity, could be bigger than m_size if one smaller bitmap has been assigned to it, after a copy() called.

◆ m_size

size_t Bitset::m_size
private

Bitset size in bytes.


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