Embedded Template Library 1.0
etl::bitset< Active_Bits, TElement, true > Class Template Reference

#include <bitset_new.h>

Classes

class  bit_reference
 The reference type returned. More...
 

Public Types

typedef etl::make_unsigned< TElement >::type element_type
 
typedef element_type * pointer
 
typedef const element_type * const_pointer
 
typedef etl::span< element_type, Number_Of_Elements > span_type
 
typedef etl::span< const element_type, Number_Of_Elements > const_span_type
 

Public Member Functions

ETL_CONSTEXPR14 bitset () ETL_NOEXCEPT
 Default constructor.
 
ETL_CONSTEXPR14 bitset (const bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 Copy constructor.
 
ETL_CONSTEXPR14 bitset (unsigned long long value) ETL_NOEXCEPT
 Construct from a value.
 
ETL_CONSTEXPR14 bitset (const char *text) ETL_NOEXCEPT
 Construct from a string.
 
ETL_CONSTEXPR14 bitset (const wchar_t *text) ETL_NOEXCEPT
 Construct from a string.
 
ETL_CONSTEXPR14 bitset (const char16_t *text) ETL_NOEXCEPT
 Construct from a string.
 
ETL_CONSTEXPR14 bitset (const char32_t *text) ETL_NOEXCEPT
 Construct from a string.
 
ETL_CONSTEXPR14 bitsetoperator= (const bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 Assignment operator.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set () ETL_NOEXCEPT
 Set all of the bits.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (element_type value) ETL_NOEXCEPT
 Set from a value.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (size_t position, bool value=true)
 Set the bit at the position.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (const char *text) ETL_NOEXCEPT
 Set from a string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (const wchar_t *text) ETL_NOEXCEPT
 Set from a string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (const char16_t *text) ETL_NOEXCEPT
 Set from a string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & set (const char32_t *text) ETL_NOEXCEPT
 Set from a string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & from_string (const char *text) ETL_NOEXCEPT
 Set from a string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & from_string (const wchar_t *text) ETL_NOEXCEPT
 Set from a wide string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & from_string (const char16_t *text) ETL_NOEXCEPT
 Set from a u16 string.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & from_string (const char32_t *text) ETL_NOEXCEPT
 Set from a u32 string.
 
template<typename T >
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value, T >::type value () const ETL_NOEXCEPT
 Get as an integral value.
 
ETL_CONSTEXPR14 unsigned long to_ulong () const ETL_NOEXCEPT
 Get as an unsigned long.
 
ETL_CONSTEXPR14 unsigned long long to_ullong () const ETL_NOEXCEPT
 Get as an unsigned long long.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & reset () ETL_NOEXCEPT
 Reset all of the bits.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & reset (size_t position)
 Reset the bit at the position.
 
ETL_CONSTEXPR14 bool test (size_t position) const
 
ETL_CONSTEXPR14 size_t size () const ETL_NOEXCEPT
 The number of bits in the bitset.
 
ETL_CONSTEXPR14 size_t count () const ETL_NOEXCEPT
 Count the number of bits set.
 
ETL_CONSTEXPR14 bool all () const ETL_NOEXCEPT
 
ETL_CONSTEXPR14 bool all (element_type mask) const ETL_NOEXCEPT
 
ETL_CONSTEXPR14 bool none () const ETL_NOEXCEPT
 Are none of the bits set?
 
ETL_CONSTEXPR14 bool none (element_type mask) const ETL_NOEXCEPT
 Are none of the bits set?
 
ETL_CONSTEXPR14 bool any () const ETL_NOEXCEPT
 Are any of the bits set?
 
ETL_CONSTEXPR14 bool any (element_type mask) const ETL_NOEXCEPT
 Are any of the bits set?
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & flip () ETL_NOEXCEPT
 Flip all of the bits.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & flip_bits (element_type mask=etl::integral_limits< element_type >::max) ETL_NOEXCEPT
 Flip some of the bits.
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & flip (size_t position)
 Flip the bit at the position.
 
ETL_CONSTEXPR14 bool operator[] (size_t position) const ETL_NOEXCEPT
 Read [] operator.
 
ETL_CONSTEXPR14 bit_reference operator[] (size_t position) ETL_NOEXCEPT
 Write [] operator.
 
template<typename TString >
ETL_CONSTEXPR14 TString to_string (typename TString::value_type zero=typename TString::value_type('0'), typename TString::value_type one=typename TString::value_type('1')) const
 Returns a string representing the bitset.
 
ETL_CONSTEXPR14 size_t find_first (bool state) const ETL_NOEXCEPT
 
ETL_CONSTEXPR14 size_t find_next (bool state, size_t position) const ETL_NOEXCEPT
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator& (const bitset< Active_Bits, TElement, true > &other) const ETL_NOEXCEPT
 operator &
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & operator&= (const bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 operator &=
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator| (const bitset< Active_Bits, TElement, true > &other) const ETL_NOEXCEPT
 operator |
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & operator|= (const bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 operator |=
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator^ (const bitset< Active_Bits, TElement, true > &other) const ETL_NOEXCEPT
 operator ^
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & operator^= (const bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 operator ^=
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator~ () const ETL_NOEXCEPT
 operator ~
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator<< (size_t shift) const ETL_NOEXCEPT
 operator <<
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & operator<<= (size_t shift) ETL_NOEXCEPT
 operator <<=
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > operator>> (size_t shift) const ETL_NOEXCEPT
 operator >>
 
ETL_CONSTEXPR14 bitset< Active_Bits, TElement, true > & operator>>= (size_t shift) ETL_NOEXCEPT
 operator >>=
 
ETL_CONSTEXPR14 void swap (etl::bitset< Active_Bits, TElement, true > &other) ETL_NOEXCEPT
 swap
 
ETL_CONSTEXPR14 span_type span () ETL_NOEXCEPT
 
ETL_CONSTEXPR14 const_span_type span () const ETL_NOEXCEPT
 

Static Public Attributes

static ETL_CONSTANT size_t Bits_Per_Element = etl::integral_limits<element_type>::bits
 
static ETL_CONSTANT size_t Number_Of_Elements = 1U
 
static ETL_CONSTANT size_t Allocated_Bits = Bits_Per_Element
 
static ETL_CONSTANT element_type All_Set_Element = etl::integral_limits<typename etl::make_unsigned<element_type>::type>::max
 
static ETL_CONSTANT element_type All_Clear_Element = element_type(0)
 
static ETL_CONSTANT size_t Top_Mask_Shift = 0U
 
static ETL_CONSTANT element_type Top_Mask = All_Set_Element
 
- Static Public Attributes inherited from etl::bitset_constants< T >
static ETL_CONSTANT size_t npos = etl::integral_limits<size_t>::max
 

Friends

ETL_CONSTEXPR14 bool operator== (const bitset< Active_Bits, TElement, true > &lhs, const bitset< Active_Bits, TElement, true > &rhs) ETL_NOEXCEPT
 operator ==
 

Detailed Description

template<size_t Active_Bits, typename TElement>
class etl::bitset< Active_Bits, TElement, true >

Specialisation that uses a single element if the element type is the same size as the number of active bits.

Member Function Documentation

◆ find_first()

template<size_t Active_Bits, typename TElement >
ETL_CONSTEXPR14 size_t etl::bitset< Active_Bits, TElement, true >::find_first ( bool  state) const
inline

Finds the first bit in the specified state.

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

◆ find_next()

template<size_t Active_Bits, typename TElement >
ETL_CONSTEXPR14 size_t etl::bitset< Active_Bits, TElement, true >::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 npos if none were found.

◆ span() [1/2]

template<size_t Active_Bits, typename TElement >
ETL_CONSTEXPR14 const_span_type etl::bitset< Active_Bits, TElement, true >::span ( ) const
inline

span Returns a const span of the underlying buffer.

◆ span() [2/2]

template<size_t Active_Bits, typename TElement >
ETL_CONSTEXPR14 span_type etl::bitset< Active_Bits, TElement, true >::span ( )
inline

span Returns a span of the underlying buffer.

◆ test()

template<size_t Active_Bits, typename TElement >
ETL_CONSTEXPR14 bool etl::bitset< Active_Bits, TElement, true >::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: