BaseBitSet< ALLOCATOR > Class Template Reference Data Structures

#include <basebitset.h>

详细描述

template<typename ALLOCATOR = DefaultAllocator>
class maxon::BaseBitSet< ALLOCATOR >

BaseBitSet 文档编制。

公共成员函数

  BaseBitSet ()=default
  BaseBitSet ( BaseBitSet &&rhs)
BaseBitSet operator= ( BaseBitSet &&rhs)
Bool   IsSet ( UInt index) const
MAXON_ATTRIBUTE_FORCE_INLINE Bool   IsSetUnchecked ( UInt index) const
MAXON_ATTRIBUTE_FORCE_INLINE void  ClearUnchecked ( UInt index)
Result < void >  Set ( UInt index, Bool &isSet)
Bool   IsEmpty () const
Bool   IsPopulated () const
Result < void >  Set ( UInt index)
void  SetUnchecked ( UInt index)
Bool   SetAndCheckUnchecked ( UInt index)
Result < void >  SetRange ( UInt first, UInt last)
void  SetRangeUnchecked ( UInt first, UInt last)
void  清零 ( UInt index, Bool &cleared)
void  清零 ( UInt index)
void  重置 ()
HashInt   GetHashCode () const
Bool   operator== (const BaseBitSet < ALLOCATOR > &rhs) const
BaseBitSet < ALLOCATOR > &  operator|= (const BaseBitSet < ALLOCATOR > &rhs)
BaseBitSet < ALLOCATOR > &  operator&= (const BaseBitSet < ALLOCATOR > &rhs)
Result < void >  CopyFrom (const BaseBitSet < ALLOCATOR > & src )
Result < void >  MergeOr (const BaseBitSet < ALLOCATOR > & src )
Result < void >  MergeOrNot (const BaseBitSet < ALLOCATOR > & src )
Result < void >  MergeAnd (const BaseBitSet < ALLOCATOR > & src )
Result < void >  MergeAndNot (const BaseBitSet < ALLOCATOR > & src )
Result < void >  MergeXOr (const BaseBitSet < ALLOCATOR > & src )
void  Invert ()
Result < void >  Init ( UInt count, Bool clearValue)
Int   CountBits ( UInt first=0, UInt last=( UInt ) -1) const
Int   GetCapacity () const

静态公共成员函数

static Result < void >  DescribeIO (const DataSerializeInterface &stream)

Private Types

using  IntType = UInt

私有成员函数

  MAXON_DISALLOW_COPY_AND_ASSIGN ( BaseBitSet )
void  RemoveTrailingZeroes ()
Int   CountBitsInWord ( IntType word) const

Private Attributes

BaseArray < IntType , BASEARRAY_DEFAULT_CHUNK_SIZE , BASEARRAYFLAGS::MOVEANDCOPYOBJECTS , ALLOCATOR >  _bits

Static Private Attributes

static const Int   IntTypeBitCount
static const UInt   INT_WIDTH_EXPONENT
static const IntType   INT_MASK
static const IntType   INT_WIDTH

Member Typedef Documentation

◆  IntType

using IntType = UInt
private

构造函数 & 析构函数文档编制

◆  BaseBitSet() [1/2]

BaseBitSet ( )
default

Default constructor.

◆  BaseBitSet() [2/2]

BaseBitSet ( BaseBitSet < ALLOCATOR > &&  rhs )

Move constructor

参数
[in] rhs The bitset which is moved.

成员函数文档编制

◆  MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( BaseBitSet < ALLOCATOR >  )
private

◆  operator=()

BaseBitSet & operator= ( BaseBitSet < ALLOCATOR > &&  rhs )

Move assignment operator

参数
[in] rhs The bitset which is moved.
返回
A reference to this bitset.

◆  IsSet()

Bool IsSet ( UInt   index ) const

Checks if a bit is set in the bitset.

参数
[in] index Input index of the bit which should be set.
返回
True if the bit at index is set, otherwise false.

◆  IsSetUnchecked()

MAXON_ATTRIBUTE_FORCE_INLINE Bool IsSetUnchecked ( UInt   index ) const

Checks if a bit is set in the bitset. It does not check if the underlaying array is big enough to contain a bit at this index.

参数
[in] index Input index of the bit which should be set.
返回
True if the bit at @index index is set, otherwise false.

◆  ClearUnchecked()

MAXON_ATTRIBUTE_FORCE_INLINE void ClearUnchecked ( UInt   index )

Clears a bit in the bitset. It does not check if the underlaying array is big enough to contain a bit at this index.

参数
[in] index Input index of the bit which should be set.

◆  Set() [1/2]

Result <void> Set ( UInt   index ,
Bool isSet  
)

Sets the bit at a given index and returns if it was actually set.

参数
[in] index Input index of the bit which should be set.
[out] isSet This will be set to true if the bit is actually set, otherwise to false.
返回
OK on success.

◆  IsEmpty()

Bool IsEmpty ( ) const

Check if the bitset is empty.

返回
True if no bit is set, otherwise false.

◆  IsPopulated()

Bool IsPopulated ( ) const

Check if the bitset contains at least one element.

返回
False if no bit is set, otherwise true.

◆  Set() [2/2]

Result <void> Set ( UInt   index )

Sets the bit at a given index.

参数
[in] index Input index of the bit which should be set.
返回
OK on success.

◆  SetUnchecked()

void SetUnchecked ( UInt   index )

Sets the bit at a given index. It does not check if the underlaying array is big enough to contain a bit at this index.

参数
[in] index Input index of the bit which should be set.

◆  SetAndCheckUnchecked()

Bool SetAndCheckUnchecked ( UInt   index )

Sets the bit at a given index. It does not check if the underlaying array is big enough to contain a bit at this index.

参数
[in] index Input index of the bit which should be set.
返回
true, if the bit was already set.

◆  SetRange()

Result <void> SetRange ( UInt   first ,
UInt   last  
)

Sets all bits in the given range. first must be smaller or equal to last.

参数
[in] first First element to set.
[in] last Last element to set.
返回
OK on success.

◆  SetRangeUnchecked()

void SetRangeUnchecked ( UInt   first ,
UInt   last  
)

Sets all bits in the given range. first must be smaller or equal to last.

参数
[in] first First element to set.
[in] last Last element to set.

◆  Clear() [1/2]

void Clear ( UInt   index ,
Bool cleared  
)

Clears the bit at a given index and returns if it was actually cleared.

参数
[in] index Input index of the bit which should be cleared.
[out] cleared This will be set to true if the bit is actually cleared, otherwise to false.

◆  Clear() [2/2]

void Clear ( UInt   index )

Clears the bit at a given index.

参数
[in] index Input index of the bit which should be cleared.

◆  Reset()

void Reset ( )

Resets the bitset.

◆  GetHashCode()

HashInt GetHashCode ( ) const

Gets the hash code for the bitset, using GetHashCode() of the underlaying BaseArray .

返回
The bitset's hash code.

◆  operator==()

Bool operator== ( const BaseBitSet < ALLOCATOR > &  rhs ) const

Compares two bitsets, using the compare operator of the underlaying BaseArray .

参数
[in] rhs Input bitset rhs.
返回
The component-by-component result of this == rhs .

◆  operator|=()

BaseBitSet <ALLOCATOR>& operator|= ( const BaseBitSet < ALLOCATOR > &  rhs )

Calculates the bitwise OR of this bitset and another bitset.

参数
[in] rhs Input bitset rhs.
返回
A reference to this bitset.

◆  operator&=()

BaseBitSet <ALLOCATOR>& operator&= ( const BaseBitSet < ALLOCATOR > &  rhs )

Calculates the bitwise AND of this bitset and another bitset.

参数
[in] rhs Input bitset rhs.
返回
A reference to this bitset.

◆  CopyFrom()

Result <void> CopyFrom ( const BaseBitSet < ALLOCATOR > &  src )

Copies the data from another bitset, using CopyFrom() of the underlaying BaseArray

参数
[in] src Source from which the data is taken
返回
OK on success.

◆  MergeOr()

Result <void> MergeOr ( const BaseBitSet < ALLOCATOR > &  src )

Merges the data from another bitset with logical OR. If the other bitset is larger it will resize this one.

参数
[in] src Source from which the data is merged.
返回
OK on success.

◆  MergeOrNot()

Result <void> MergeOrNot ( const BaseBitSet < ALLOCATOR > &  src )

Merges the data from another bitset with logical OR NOT. If the other bitset is larger it will resize this one.

参数
[in] src Source from which the data is merged.
返回
OK on success.

◆  MergeAnd()

Result <void> MergeAnd ( const BaseBitSet < ALLOCATOR > &  src )

Merges the data from another bitset with logical AND. If the other bitset is larger it will resize this one.

参数
[in] src Source from which the data is merged.
返回
OK on success.

◆  MergeAndNot()

Result <void> MergeAndNot ( const BaseBitSet < ALLOCATOR > &  src )

Merges the data from another bitset with logical AND NOT. If the other bitset is larger it will resize this one.

参数
[in] src Source from which the data is merged.
返回
OK on success.

◆  MergeXOr()

Result <void> MergeXOr ( const BaseBitSet < ALLOCATOR > &  src )

Merges the data from another bitset with logical XOR. If the other bitset is larger it will resize this one.

参数
[in] src Source from which the data is merged.
返回
OK on success.

◆  Invert()

void Invert ( )

Inverts all bits of the BaseBitSet .

◆  Init()

Result <void> Init ( UInt   count ,
Bool   clearValue  
)

Initializes the array to have at least as much space to contain a certain amount of bits.

参数
[in] count Number of bits.

◆  CountBits()

Int CountBits ( UInt   first = 0 ,
UInt   last = (UInt)-1  
) const

Counts the bits in the selection

参数
[in] first Index from which conting starts.
[in] last Index where counting ends.
返回
Number of set bits.

◆  GetCapacity()

Int GetCapacity ( ) const

Get The maximum capacity of the BitSet

返回
Number maximum bits.

◆  DescribeIO()

static Result <void> DescribeIO ( const DataSerializeInterface stream )
static

Describe all elements of this class for I/O operations.

参数
[in] stream The stream that is used to register the class members.
返回
OK on success.

◆  RemoveTrailingZeroes()

void RemoveTrailingZeroes ( )
private

Removes trailing zero bits in the underlaying BaseArray

◆  CountBitsInWord()

Int CountBitsInWord ( IntType   word ) const
private

Counts the bits of a word.

参数
[in] word Word in which the bits have to be counted.
返回
Number of set bits in the word.

Member Data Documentation

◆  IntTypeBitCount

const Int IntTypeBitCount
static private

◆  INT_WIDTH_EXPONENT

const UInt INT_WIDTH_EXPONENT
static private

◆  INT_MASK

const IntType INT_MASK
static private

◆  INT_WIDTH

const IntType INT_WIDTH
static private

◆  _bits

BaseArray < IntType , BASEARRAY_DEFAULT_CHUNK_SIZE , BASEARRAYFLAGS::MOVEANDCOPYOBJECTS , ALLOCATOR> _bits
private