COSA
An Object-Oriented Platform for Arduino Programming
BitSet< N > Class Template Reference

#include <BitSet.hh>

Collaboration diagram for BitSet< N >:
Collaboration graph

Public Member Functions

 BitSet ()
 
uint16_t members () const
 
const uint8_t * bits () const
 
void empty ()
 
bool is_empty () const
 
bool operator[] (uint16_t ix) const
 
void operator+= (uint16_t ix)
 
void operator-= (uint16_t ix)
 
void operator= (BitSet &rhs)
 
void operator+= (BitSet &rhs)
 
void operator-= (BitSet &rhs)
 
bool operator== (BitSet &rhs)
 

Friends

IOStreamoperator<< (IOStream &outs, BitSet &rhs)
 

Detailed Description

template<uint16_t N>
class BitSet< N >

Bitset implemented as a template class with a byte vector for the elements as bits.

Parameters
[in]Nmax number of elements in bitset.

Definition at line 33 of file BitSet.hh.

Constructor & Destructor Documentation

template<uint16_t N>
BitSet< N >::BitSet ( )
inline

Construct bitset and empty.

Definition at line 38 of file BitSet.hh.

Member Function Documentation

template<uint16_t N>
const uint8_t* BitSet< N >::bits ( ) const
inline

Return bit vector.

Returns
bit vector.

Definition at line 56 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::empty ( )
inline

Empty bitset.

Definition at line 64 of file BitSet.hh.

template<uint16_t N>
bool BitSet< N >::is_empty ( ) const
inline

Return true if the bitset is empty.

Definition at line 73 of file BitSet.hh.

template<uint16_t N>
uint16_t BitSet< N >::members ( ) const
inline

Return max number of elements in the bitset.

Definition at line 47 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::operator+= ( uint16_t  ix)
inline

Add element index to the bitset.

Parameters
[in]ixelement to add (0..N-1).

Definition at line 93 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::operator+= ( BitSet< N > &  rhs)
inline

Add element from the given bitset. Bitset must be the same size.

Parameters
[in]rhsbitset to add from.

Definition at line 122 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::operator-= ( uint16_t  ix)
inline

Remove element index from the bitset.

Parameters
[in]ixelement to remove (0..N-1).

Definition at line 102 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::operator-= ( BitSet< N > &  rhs)
inline

Remove elements from the given bitset. Bitset must be the same size.

Parameters
[in]rhsbitset to remove.

Definition at line 133 of file BitSet.hh.

template<uint16_t N>
void BitSet< N >::operator= ( BitSet< N > &  rhs)
inline

Assign bitset with given value. Bitset must be the same size.

Parameters
[in]rhsbitset to assign from.

Definition at line 111 of file BitSet.hh.

template<uint16_t N>
bool BitSet< N >::operator== ( BitSet< N > &  rhs)
inline

Check if the bitsets are equal. Return false if they are not of same size.

Parameters
[in]rhsbitset to assign from.

Definition at line 145 of file BitSet.hh.

template<uint16_t N>
bool BitSet< N >::operator[] ( uint16_t  ix) const
inline

Check if the given element index is a member of the bitset.

Returns
bool

Definition at line 84 of file BitSet.hh.

Friends And Related Function Documentation

template<uint16_t N>
IOStream& operator<< ( IOStream outs,
BitSet< N > &  rhs 
)
friend

Print bitset to the given output stream.

Parameters
[in]outsoutput stream.
[in]rhsbit set to print.
Returns
output stream.

Definition at line 157 of file BitSet.hh.


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