Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

base_bitset Class Reference

provides the bit functionality More...

#include <bitset.h>

Inheritance diagram for base_bitset:

_bitset bitset

List of all members.

Public Member Functions

bool set (size_t index, bool value)
 sets bit value by index
bool get (size_t index) const
 returns bit value by index
bool find_first_free (size_t &index) const
 finds first zero bit
bool empty () const
 checks if set is empty
bool operator== (const base_bitset &x) const
 equal operator
bool operator!= (const base_bitset &x) const
 non equal operator
base_bitsetoperator|= (const base_bitset &x)
 operator |=
base_bitsetoperator &= (const base_bitset &x)
 operator &=
void reset ()
 sets all bits to zero
bool operator< (const base_bitset &x) const
 operator<

Protected Member Functions

 base_bitset (size_t capacity)
 constructor

Static Protected Member Functions

static size_t get_byte_len (size_t bitlen)
 returns the min bytes required to accomodate bits
static size_t offset (size_t index)
 returns required offset in bytes for index );
static unsigned char mask (size_t index)
 returns the mask for reminder of bits by index

Protected Attributes

size_t _capacity
 capacity - max bits stored in set
unsigned char * _bits
 array of bytes

Private Types

enum  en_bitset { bs_bits_in_byte = 8, bs_offset = 3, bs_mask = bs_bits_in_byte - 1 }


Detailed Description

provides the bit functionality

Definition at line 38 of file bitset.h.


Member Enumeration Documentation

enum base_bitset::en_bitset [private]

Enumerator:
bs_bits_in_byte  bits in byte
bs_offset  power of 2 for bits in bytes
bs_mask  mask for one byte

Definition at line 41 of file bitset.h.


Constructor & Destructor Documentation

base_bitset::base_bitset ( size_t  capacity  )  [inline, protected]

constructor

Parameters:
capacity  capacity

Definition at line 58 of file bitset.hpp.


Member Function Documentation

bool base_bitset::set ( size_t  index,
bool  value 
) [inline]

sets bit value by index

Parameters:
index  index
value  value

Definition at line 64 of file bitset.hpp.

References _bits, _capacity, mask(), and offset().

Referenced by content_leaf::calc_pos(), and content_any::calc_pos().

bool base_bitset::get ( size_t  index  )  const [inline]

returns bit value by index

Parameters:
index  index

Definition at line 84 of file bitset.hpp.

References _bits, _capacity, mask(), and offset().

Referenced by content_children::build_dfa(), and content_children::calc_follow_list().

bool base_bitset::find_first_free ( size_t &  index  )  const [inline]

finds first zero bit

Parameters:
index  index

Definition at line 98 of file bitset.hpp.

References _bits, _capacity, bs_bits_in_byte, get_byte_len(), and low_zero_in_byte.

bool base_bitset::empty (  )  const [inline]

checks if set is empty

Definition at line 195 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

Referenced by content_children::build_dfa(), content_node::get_firstPos(), and content_node::get_lastPos().

bool base_bitset::operator== ( const base_bitset x  )  const [inline]

equal operator

Definition at line 144 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

Referenced by operator!=().

bool base_bitset::operator!= ( const base_bitset x  )  const [inline]

non equal operator

Definition at line 158 of file bitset.hpp.

References operator==().

base_bitset & base_bitset::operator|= ( const base_bitset x  )  [inline]

operator |=

Definition at line 165 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

base_bitset & base_bitset::operator &= ( const base_bitset x  )  [inline]

operator &=

Definition at line 176 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

void base_bitset::reset (  )  [inline]

sets all bits to zero

Definition at line 187 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

Referenced by content_children::build_dfa(), content_leaf::calc_pos(), and content_any::calc_pos().

bool base_bitset::operator< ( const base_bitset x  )  const [inline]

operator<

Definition at line 210 of file bitset.hpp.

References _bits, _capacity, and get_byte_len().

size_t base_bitset::get_byte_len ( size_t  bitlen  )  [inline, static, protected]

returns the min bytes required to accomodate bits

Parameters:
bitlen  bit length

Definition at line 120 of file bitset.hpp.

References bs_mask, and bs_offset.

Referenced by _bitset::_bitset(), _bitset::assign(), bitset::bitset(), empty(), find_first_free(), operator &=(), operator<(), bitset::operator=(), operator==(), operator|=(), reset(), bitset::resize(), and _bitset::resize().

size_t base_bitset::offset ( size_t  index  )  [inline, static, protected]

returns required offset in bytes for index );

Parameters:
index  index

Definition at line 129 of file bitset.hpp.

References bs_offset.

Referenced by get(), and set().

unsigned char base_bitset::mask ( size_t  index  )  [inline, static, protected]

returns the mask for reminder of bits by index

Parameters:
index  index

Definition at line 137 of file bitset.hpp.

References bs_mask.

Referenced by get(), and set().


Member Data Documentation


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


© Copyright Terimber 2003-.