Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::bitset_ext< Active_Bits, TElement > Class Template Reference

A bitset that uses externally declared storage. More...

#include <bitset_new.h>

Classes

class  bit_reference
 The reference type returned. More...

Public Types

typedef size_t size_type
typedef etl::private_bitset::bitset_common< Active_Bits, TElement >::element_type element_type
typedef etl::private_bitset::bitset_common< Active_Bits, TElement >::span_type span_type
typedef etl::private_bitset::bitset_common< Active_Bits, TElement >::const_span_type const_span_type
typedef etl::array< TElement, Number_Of_Elements > buffer_type
Public Types inherited from etl::private_bitset::bitset_common< Active_Bits, TElement >
typedef etl::private_bitset::bitset_impl_common< TElement >::element_type element_type
typedef etl::span< element_type, Number_Of_Elements > span_type
typedef etl::span< const element_type, Number_Of_Elements > const_span_type
Public Types inherited from etl::private_bitset::bitset_impl_common< TElement >
typedef TElement element_type
typedef TElement * pointer
typedef const TElement * const_pointer
typedef size_t size_type

Public Member Functions

 ETL_STATIC_ASSERT (etl::is_unsigned< TElement >::value, "The element type must be unsigned")
ETL_CONSTEXPR14 bitset_ext (element_type *pbuffer_)
 Default constructor.
ETL_CONSTEXPR14 bitset_ext (buffer_type &buffer)
 Default constructor.
ETL_CONSTEXPR14 bitset_ext (const bitset_ext< Active_Bits, TElement > &other, element_type *pbuffer_)
 Construct copy.
ETL_CONSTEXPR14 bitset_ext (const bitset_ext< Active_Bits, TElement > &other, buffer_type &buffer) ETL_NOEXCEPT
 Construct copy.
ETL_CONSTEXPR14 bitset_ext (const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT ETL_DELETE
 Copy Constructor (Deleted).
ETL_CONSTEXPR14 bitset_ext (unsigned long long value, element_type *pbuffer_)
 Construct from a value.
template<typename TValue>
ETL_CONSTEXPR14 bitset_ext (TValue value, buffer_type &buffer, typename etl::enable_if< is_integral< TValue >::value >::type *=0) ETL_NOEXCEPT
 Construct from a value.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char * >::value >::type *=0)
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char * >::value >::type *=0) ETL_NOEXCEPT
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const wchar_t * >::value >::type *=0)
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const wchar_t * >::value >::type *=0) ETL_NOEXCEPT
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char16_t * >::value >::type *=0)
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char16_t * >::value >::type *=0) ETL_NOEXCEPT
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char32_t * >::value >::type *=0)
 Construct from a string.
template<typename TPString>
ETL_CONSTEXPR14 bitset_ext (TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char32_t * >::value >::type *=0) ETL_NOEXCEPT
 Construct from a string.
ETL_CONSTEXPR14 bitset_extoperator= (const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
 Assignment operator.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set () ETL_NOEXCEPT
 Set all of the bits.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set (size_t position, bool value=true)
 Set the bit at the position.
template<size_t Position>
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set (bool value=true)
 Set the bit at the position.
template<size_t Position, bool Value>
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set ()
 Set the bit at the position.
template<typename TPString>
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar * >::value, bitset_ext< Active_Bits, TElement > & >::type set (TPString text) ETL_NOEXCEPT
 Set from a string.
template<typename TPString>
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constwchar_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set (TPString text) ETL_NOEXCEPT
 Set from a wide string.
template<typename TPString>
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar16_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set (TPString text) ETL_NOEXCEPT
 Set from a char16 string.
template<typename TPString>
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar32_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set (TPString text) ETL_NOEXCEPT
 Set from a char32 string.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string (const char *text) ETL_NOEXCEPT
 Set from a string.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string (const wchar_t *text) ETL_NOEXCEPT
 Set from a wide string.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string (const char16_t *text) ETL_NOEXCEPT
 Set from a u16 string.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string (const char32_t *text) ETL_NOEXCEPT
 Set from a u32 string.
template<typename T>
ETL_CONSTEXPR14 T value () const ETL_NOEXCEPT
 Get as an integral value.
template<typename T>
ETL_CONSTEXPR14 T extract (size_t position, size_t length=etl::integral_limits< T >::bits)
template<typename T, size_t Position, size_t Length>
ETL_CONSTEXPR14 T extract () const
unsigned long to_ulong () const
 Get as an unsigned long.
unsigned long long to_ullong () const
 Get as an unsigned long long.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & reset () ETL_NOEXCEPT
 Reset all of the bits.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & reset (size_t position)
 Reset the bit at the position.
ETL_CONSTEXPR14 bool test (size_t position) const
template<size_t Position>
ETL_CONSTEXPR14 bool test () const
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 mask 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 mask bits set?
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & flip () ETL_NOEXCEPT
 Flip all of the bits.
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & 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_ext< Active_Bits, TElement > & operator&= (const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
 operator &=
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator|= (const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
 operator |=
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator^= (const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
 operator ^=
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator<<= (size_t shift) ETL_NOEXCEPT
 operator <<=
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator>>= (size_t shift) ETL_NOEXCEPT
 operator >>=
ETL_CONSTEXPR14 void swap (etl::bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
 swap
ETL_CONSTEXPR14 span_type span () ETL_NOEXCEPT
ETL_CONSTEXPR14 const_span_type span () const ETL_NOEXCEPT

Static Public Member Functions

static ETL_CONSTEXPR size_t size () ETL_NOEXCEPT
 The number of bits in the bitset.
static ETL_CONSTEXPR size_t number_of_elements () ETL_NOEXCEPT
 The number of storage elements in the bitset.
static ETL_CONSTEXPR element_type all_set_element () ETL_NOEXCEPT
 The value of a set element.
static ETL_CONSTEXPR element_type all_clear_element () ETL_NOEXCEPT
 The value of a clear element.
static ETL_CONSTEXPR element_type top_mask () ETL_NOEXCEPT
 The mask for the msb element.
static ETL_CONSTEXPR size_t bits_per_element () ETL_NOEXCEPT
 The number of bits in an element.
static ETL_CONSTEXPR size_t allocated_bits () ETL_NOEXCEPT
 The total number of bits of storage, including unused.
static ETL_CONSTEXPR etl::bitset_storage_model storage_model () ETL_NOEXCEPT

Friends

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

Additional Inherited Members

Static Public Attributes inherited from etl::private_bitset::bitset_common< Active_Bits, TElement >
static ETL_CONSTANT size_t Number_Of_Elements = (Active_Bits % Bits_Per_Element == 0) ? Active_Bits / Bits_Per_Element : Active_Bits / Bits_Per_Element + 1
static ETL_CONSTANT size_t Size = Active_Bits
static ETL_CONSTANT size_t Allocated_Bits = Number_Of_Elements * Bits_Per_Element
static ETL_CONSTANT etl::bitset_storage_model Storage_Model
static ETL_CONSTANT TElement Top_Mask = element_type(Top_Mask_Shift == 0 ? All_Set_Element : ~(All_Set_Element << Top_Mask_Shift))
Static Public Attributes inherited from etl::private_bitset::bitset_impl_common< TElement >
static ETL_CONSTANT size_t npos = etl::integral_limits<size_t>::max
static ETL_CONSTANT size_t Bits_Per_Element = etl::integral_limits<TElement>::bits
static ETL_CONSTANT TElement All_Set_Element = etl::integral_limits<TElement>::max
static ETL_CONSTANT TElement All_Clear_Element = element_type(0)

Detailed Description

template<size_t Active_Bits, typename TElement>
class etl::bitset_ext< Active_Bits, TElement >

A bitset that uses externally declared storage.

Member Function Documentation

◆ extract() [1/2]

template<size_t Active_Bits, typename TElement>
template<typename T, size_t Position, size_t Length>
ETL_CONSTEXPR14 T etl::bitset_ext< Active_Bits, TElement >::extract ( ) const
inline

Extract an integral value from an arbitrary position and length. Compile time position and length.

◆ extract() [2/2]

template<size_t Active_Bits, typename TElement>
template<typename T>
ETL_CONSTEXPR14 T etl::bitset_ext< Active_Bits, TElement >::extract ( size_t position,
size_t length = etl::integral_limits<T>::bits )
inline

Extract an integral value from an arbitrary position and length. Run time position and length.

◆ find_first()

template<size_t Active_Bits, typename TElement>
ETL_CONSTEXPR14 size_t etl::bitset_ext< Active_Bits, TElement >::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_ext< Active_Bits, TElement >::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_ext< Active_Bits, TElement >::span ( ) const
inline

span Returns a const span of the underlying pbuffer.

◆ span() [2/2]

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

span Returns a span of the underlying pbuffer.

◆ storage_model()

template<size_t Active_Bits, typename TElement>
ETL_CONSTEXPR etl::bitset_storage_model etl::bitset_ext< Active_Bits, TElement >::storage_model ( )
inlinestatic

The storage model for the bitset. etl::bitset_storage_model::Single etl::bitset_storage_model::Multi

◆ test() [1/2]

template<size_t Active_Bits, typename TElement>
template<size_t Position>
ETL_CONSTEXPR14 bool etl::bitset_ext< Active_Bits, TElement >::test ( ) const
inline

Tests a bit at a position. Positions greater than the number of configured bits will not compile.

◆ test() [2/2]

template<size_t Active_Bits, typename TElement>
ETL_CONSTEXPR14 bool etl::bitset_ext< Active_Bits, TElement >::test ( size_t position) const
inline

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

◆ operator!=

template<size_t Active_Bits, typename TElement>
ETL_CONSTEXPR14 bool operator!= ( const bitset_ext< Active_Bits, TElement > & lhs,
const bitset_ext< Active_Bits, TElement > & rhs )
friend

operator !=

operator !=


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