Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

ibitset Class Reference

The base class for etl::bitset. More...

#include <bitset.h>

Inherited by bitset< WIDTH >, and bitset< MAXN >.

Data Structures

class  bit_reference
 The reference type returned. More...

Public Member Functions

size_t size () const
 The size of the bitset.
size_t count () const
 Count the number of bits set.
bool test (size_t position) const
 Tests a bit at a position.
ibitsetset ()
 Set the bit at the position.
ibitsetset (size_t position, bool value=true)
 Set the bit at the position.
ibitsetset (const char *text)
 Set from a string.
ibitsetreset ()
 Resets the bitset.
ibitsetreset (size_t position)
 Reset the bit at the position.
ibitsetflip ()
 Flip all of the bits.
ibitsetflip (size_t position)
 Flip the bit at the position.
bool any () const
 Are any of the bits set?
bool none () const
 Are none of the bits set?
size_t find_first (bool state) const
 Finds the first bit in the specified state.
size_t find_next (bool state, size_t position) const
 Finds the next bit in the specified state.
bool operator[] (size_t position) const
 Read [] operator.
bit_reference operator[] (size_t position)
 Write [] operator.
ibitsetoperator&= (const ibitset &other)
 operator &=
ibitsetoperator|= (const ibitset &other)
 operator |=
ibitsetoperator^= (const ibitset &other)
 operator ^=
ibitsetoperator<<= (size_t shift)
 operator <<=
ibitsetoperator>>= (size_t shift)
 operator >>=
ibitsetoperator= (const ibitset &other)
 operator =
void swap (ibitset &other)
 swap

Protected Member Functions

ibitsetinitialise (unsigned long long value)
 Initialise from an unsigned long long.
void invert ()
 Invert.
bit_reference get_bit_reference (size_t position)
 Gets a reference to the specified bit.
 ibitset (size_t nbits_, size_t size_, element_t *pdata_)
 Constructor.

Static Protected Member Functions

static bool is_equal (const ibitset &lhs, const ibitset &rhs)
 Compare bitsets.

Detailed Description

The base class for etl::bitset.

Definition at line 99 of file bitset.h.


Constructor & Destructor Documentation

ibitset ( size_t  nbits_,
size_t  size_,
element_t *  pdata_ 
) [protected]

Constructor.

Definition at line 693 of file bitset.h.


Member Function Documentation

bool any (  ) const

Are any of the bits set?

Definition at line 412 of file bitset.h.

size_t count (  ) const

Count the number of bits set.

Definition at line 209 of file bitset.h.

size_t find_first ( bool  state ) const

Finds the first bit in the specified state.

Parameters:
stateThe state to search for.
Returns:
The position of the bit or SIZE if none were found.

Definition at line 438 of file bitset.h.

size_t find_next ( bool  state,
size_t  position 
) const

Finds the next bit in the specified state.

Parameters:
stateThe state to search for.
positionThe position to start from.
Returns:
The position of the bit or SIZE if none were found.

Definition at line 449 of file bitset.h.

ibitset& flip (  )

Flip all of the bits.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 347 of file bitset.h.

ibitset& flip ( size_t  position )

Flip the bit at the position.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 362 of file bitset.h.

bit_reference get_bit_reference ( size_t  position ) [protected]

Gets a reference to the specified bit.

Definition at line 685 of file bitset.h.

ibitset& initialise ( unsigned long long  value ) [protected]

Initialise from an unsigned long long.

Definition at line 644 of file bitset.h.

void invert (  ) [protected]

Invert.

Definition at line 674 of file bitset.h.

static bool is_equal ( const ibitset lhs,
const ibitset rhs 
) [static, protected]

Compare bitsets.

Definition at line 706 of file bitset.h.

bool none (  ) const

Are none of the bits set?

Definition at line 420 of file bitset.h.

ibitset& operator&= ( const ibitset other )

operator &=

Definition at line 526 of file bitset.h.

ibitset& operator<<= ( size_t  shift )

operator <<=

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 565 of file bitset.h.

ibitset& operator= ( const ibitset other )

operator =

Definition at line 621 of file bitset.h.

ibitset& operator>>= ( size_t  shift )

operator >>=

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 593 of file bitset.h.

bit_reference operator[] ( size_t  position )

Write [] operator.

Definition at line 518 of file bitset.h.

bool operator[] ( size_t  position ) const

Read [] operator.

Definition at line 510 of file bitset.h.

ibitset& operator^= ( const ibitset other )

operator ^=

Definition at line 552 of file bitset.h.

ibitset& operator|= ( const ibitset other )

operator |=

Definition at line 539 of file bitset.h.

ibitset& reset ( size_t  position )

Reset the bit at the position.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 323 of file bitset.h.

ibitset& reset (  )

Resets the bitset.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 310 of file bitset.h.

ibitset& set ( const char *  text )

Set from a string.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 293 of file bitset.h.

ibitset& set ( size_t  position,
bool  value = true 
)

Set the bit at the position.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 262 of file bitset.h.

ibitset& set (  )

Set the bit at the position.

Reimplemented in bitset< MAXN >, and bitset< WIDTH >.

Definition at line 247 of file bitset.h.

size_t size (  ) const

The size of the bitset.

Definition at line 201 of file bitset.h.

void swap ( ibitset other )

swap

Definition at line 634 of file bitset.h.

bool test ( size_t  position ) const

Tests a bit at a position.

Positions greater than the number of configured bits will return false.

Definition at line 225 of file bitset.h.