Embedded Template Library  1.0
 All Classes Files Functions Variables Typedefs Friends Modules Pages
etl::bitset< N > Class Template Reference

#include <bitset.h>

Classes

class  bit_reference
 The reference type returned. More...
 
class  const_iterator
 The const_iterator type. More...
 
class  iterator
 The iterator type. More...
 

Public Member Functions

 bitset ()
 Default constructor.
 
 bitset (const bitset< N > &other)
 Copy constructor.
 
 bitset (unsigned long long value)
 Construct from a value.
 
 bitset (const char *text)
 Construct from a string.
 
bitset< N > & set ()
 Set all of the bits.
 
bitset< N > & set (size_t position, bool value=true)
 Set the bit at the position.
 
bitset< N > & set (const char *text)
 Set from a string.
 
bitset< N > & reset ()
 Reset all of the bits.
 
bitset< N > & reset (size_t position)
 Reset the bit at the position.
 
bitset< N > & flip ()
 Flip all of the bits.
 
bitset< N > & flip (size_t position)
 Flip the bit at the position.
 
bool operator[] (size_t position) const
 Read [] operator.
 
bit_reference operator[] (size_t position)
 Write [] operator.
 
bool test (size_t position) const
 
bool all () const
 
bool any () const
 Are any of the bits set?
 
bool none () const
 Are none of th bits set?
 
size_t count () const
 Count the number of bits set.
 
size_t size () const
 The size of the bitset.
 
size_t find_first (bool state) const
 
size_t find_next (bool state, size_t position) const
 
bitset< N > & operator&= (const bitset< N > &other)
 operator &=
 
bitset< N > & operator|= (const bitset< N > &other)
 operator |=
 
bitset< N > & operator^= (const bitset< N > &other)
 operator ^=
 
bitset< N > operator~ () const
 operator ~
 
bitset< N > operator<< (size_t shift) const
 operator <<
 
bitset< N > & operator<<= (size_t shift)
 operator <<=
 
bitset< N > operator>> (size_t shift) const
 operator >>
 
bitset< N > & operator>>= (size_t shift)
 operator >>=
 
void swap (bitset< N > &other)
 swap
 
iterator begin ()
 begin
 
const_iterator begin () const
 begin
 
const_iterator cbegin ()
 cbegin
 
iterator end ()
 end
 
const_iterator end () const
 end
 
const_iterator cend ()
 cend
 
- Public Member Functions inherited from etl::ibitset
 ibitset ()
 Default constructor.
 
virtual ~ibitset ()
 Destructor.
 

Friends

bool operator== (const bitset< N > &lhs, const bitset< N > &rhs)
 operator ==
 

Detailed Description

template<const size_t N>
class etl::bitset< N >

The class emulates an array of bool elements, but optimized for space allocation. Will accomodate any number of bits. Does not use std::string.

Template Parameters
NThe number of bits.

Member Function Documentation

template<const size_t N>
size_t etl::bitset< N >::find_first ( bool  state) const
inlinevirtual

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.

Implements etl::ibitset.

template<const size_t N>
size_t etl::bitset< N >::find_next ( bool  state,
size_t  position 
) const
inline

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.
template<const size_t N>
bool etl::bitset< N >::test ( size_t  position) const
inline

Tests a bit at a position. Positions greater than the number of configured bits will return false.


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