engine
 
载入中...
搜索中...
未找到
类 | Public 成员函数 | 静态 Public 成员函数 | 友元 | 所有成员列表
TBitArray< Allocator > 模板类 参考

A dynamically sized bit array. 更多...

#include <BitArray.h>

类

class  FConstIterator
 Const BitArray iterator. 更多...
 
class  FConstReverseIterator
 Const reverse iterator. 更多...
 
class  FIterator
 BitArray iterator. 更多...
 

Public 成员函数

int32 Add (const bool Value)
 Adds a bit to the array with the given value. 更多...
 
int32 Add (const bool Value, int32 NumBitsToAdd)
 Adds multiple bits to the array with the given value. 更多...
 
template<typename InWordType >
int32 AddRange (const InWordType *ReadBits, int32 NumBitsToAdd, int32 ReadOffsetBits=0)
 Adds multiple bits read from the given pointer. 更多...
 
template<typename OtherAllocator >
int32 AddRange (const TBitArray< OtherAllocator > &ReadBits, int32 NumBitsToAdd, int32 ReadOffsetBits=0)
 Adds multiple bits read from the given BitArray. 更多...
 
int32 AddUninitialized (int32 NumBitsToAdd)
 Inserts space for multiple bits at the end of the array. 更多...
 
void BitwiseNOT ()
 Perform a bitwise NOT on all the bits in this array
 
void CheckInvariants () const
 Checks the invariants of this class
 
TBitArray & CombineWithBitwiseAND (const TBitArray &InOther, EBitwiseOperatorFlags InFlags)
 Perform a bitwise AND on this bit array with another. 更多...
 
TBitArray & CombineWithBitwiseOR (const TBitArray &InOther, EBitwiseOperatorFlags InFlags)
 Return the bitwise OR of two bit arrays. 更多...
 
TBitArray & CombineWithBitwiseXOR (const TBitArray &InOther, EBitwiseOperatorFlags InFlags)
 Return the bitwise XOR of two bit arrays. 更多...
 
bool CompareSetBits (const TBitArray &Other, const bool bMissingBitValue) const
 Returns true if Other contains all the same set bits as this, accounting for differences in length. 更多...
 
void CountBytes (FArchive &Ar) const
 Tracks the container's memory use through an archive.
 
int32 CountSetBits (int32 FromIndex=0, int32 ToIndex=INDEX_NONE) const
 Count the number of set bits in this array FromIndex <= bit < ToIndex
 
void Empty (int32 ExpectedNumBits=0)
 Removes all bits from the array, potentially leaving space allocated for an expected number of bits about to be added. 更多...
 
int32 Find (bool bValue) const
 Finds the first true/false bit in the array, and returns the bit index. 更多...
 
int32 FindAndSetFirstZeroBit (int32 ConservativeStartIndex=0)
 Finds the first zero bit in the array, sets it to true, and returns the bit index. 更多...
 
int32 FindAndSetLastZeroBit ()
 Finds the last zero bit in the array, sets it to true, and returns the bit index. 更多...
 
int32 FindLast (bool bValue) const
 Finds the last true/false bit in the array, and returns the bit index. 更多...
 
uint32 GetAllocatedSize (void) const
 Helper function to return the amount of memory allocated by this container 更多...
 
template<typename InWordType >
FORCEINLINE void GetRange (int32 Index, int32 NumBitsToGet, InWordType *WriteBits, int32 WriteOffsetBits=0) const
 Reads a range of bits within the array and writes them to the given pointer. 更多...
 
FORCEINLINE void Init (bool bValue, int32 InNumBits)
 Resets the array's contents. 更多...
 
void Insert (bool Value, int32 Index)
 Adds a bit with the given value at the given index in the array. 更多...
 
void Insert (bool Value, int32 Index, int32 NumBitsToAdd)
 Inserts multiple bits with the given value into the array, starting at the given Index. 更多...
 
template<typename InWordType >
void InsertRange (const InWordType *ReadBits, int32 Index, int32 NumBitsToAdd, int32 ReadOffsetBits=0)
 Inserts multiple bits read from the given pointer, starting at the given index. 更多...
 
template<typename OtherAllocator >
void InsertRange (const TBitArray< OtherAllocator > &ReadBits, int32 Index, int32 NumBitsToAdd, int32 ReadOffsetBits=0)
 Inserts multiple bits read from the given BitArray into the array, starting at the given index. 更多...
 
void InsertUninitialized (int32 Index, int32 NumBitsToAdd)
 Inserts space for multiple bits into the array, starting at the given index. 更多...
 
FORCEINLINE TBitArray & operator= (const TBitArray &Copy)
 Assignment operator.
 
FORCEINLINE TBitArray & operator= (TBitArray &&Other)
 Move assignment.
 
int32 PadToNum (int32 DesiredNum, bool bPadValue)
 Pad this bit array with the specified value to ensure that it is at least the specified length. 更多...
 
void RemoveAt (int32 BaseIndex, int32 NumBitsToRemove=1)
 Removes bits from the array. 更多...
 
void Reserve (int32 Number)
 Reserves memory such that the array can contain at least Number bits. 更多...
 
void Reset ()
 Removes all bits from the array retaining any space already allocated.
 
void SetNumUninitialized (int32 InNumBits)
 Sets number of bits without initializing new bits.
 
FORCENOINLINE void SetRange (int32 Index, int32 NumBitsToSet, bool Value)
 Sets or unsets a range of bits within the array. 更多...
 
template<typename InWordType >
void SetRangeFromRange (int32 Index, int32 NumBitsToSet, const InWordType *ReadBits, int32 ReadOffsetBits=0)
 Sets range of bits within the TBitArray to the values read out of a pointer. 更多...
 
template<typename OtherAllocator >
FORCEINLINE void SetRangeFromRange (int32 Index, int32 NumBitsToSet, const TBitArray< OtherAllocator > &ReadBits, int32 ReadOffsetBits=0)
 Sets range of bits within this TBitArray to the values read out another TBitArray. 更多...
 
FORCEINLINE TBitArray (bool bValue, int32 InNumBits)
 Minimal initialization constructor. 更多...
 
FORCEINLINE TBitArray (const TBitArray &Copy)
 Copy constructor.
 
FORCEINLINE TBitArray (TBitArray &&Other)
 Move constructor.
 

静态 Public 成员函数

static TBitArray BitwiseAND (const TBitArray &A, const TBitArray &B, EBitwiseOperatorFlags InFlags)
 Return the bitwise AND of two bit arrays. 更多...
 
static TBitArray BitwiseOR (const TBitArray &A, const TBitArray &B, EBitwiseOperatorFlags InFlags)
 Return the bitwise OR of two bit arrays. 更多...
 
static TBitArray BitwiseXOR (const TBitArray &A, const TBitArray &B, EBitwiseOperatorFlags InFlags)
 Return the bitwise XOR of two bit arrays. 更多...
 

友元

FArchive & operator<< (FArchive &Ar, TBitArray &BitArray)
 Serializer
 
template<typename , typename , bool >
class TConstDualSetBitIterator
 
template<typename >
class TConstSetBitIterator
 

详细描述

template<typename Allocator>
class TBitArray< Allocator >

A dynamically sized bit array.

An array of Booleans. They stored in one bit/Boolean. There are iterators that efficiently iterate over only set bits.

构造及析构函数说明

◆ TBitArray()

template<typename Allocator >
FORCEINLINE TBitArray< Allocator >::TBitArray ( bool  bValue,
int32  InNumBits 
)
inlineexplicit

Minimal initialization constructor.

参数
Value- The value to initial the bits to.
InNumBits- The initial number of bits in the array.

成员函数说明

◆ Add() [1/2]

template<typename Allocator >
int32 TBitArray< Allocator >::Add ( const bool  Value)
inline

Adds a bit to the array with the given value.

返回
The index of the added bit.

◆ Add() [2/2]

template<typename Allocator >
int32 TBitArray< Allocator >::Add ( const bool  Value,
int32  NumBitsToAdd 
)
inline

Adds multiple bits to the array with the given value.

返回
The index of the first added bit.

◆ AddRange() [1/2]

template<typename Allocator >
template<typename InWordType >
int32 TBitArray< Allocator >::AddRange ( const InWordType *  ReadBits,
int32  NumBitsToAdd,
int32  ReadOffsetBits = 0 
)
inline

Adds multiple bits read from the given pointer.

参数
ReadBitsThe address of sized integers to read the bits from. Bits are read from ReadBits in the current platform's mathematical bitorder (ReadBits[0] & 0x1, ReadBits[0] & 0x2, ... ReadBits[0] & 0x100, ... ReadBits[0] & 0x80000000, ReadBits[1] & 0x1 ...
NumBitsToAddThe number of bits to add. Must be >= 0.
ReadOffsetBitsNumber of bits into ReadBits at which to start reading. Must be >= 0.
返回
The index of the first added bit.

◆ AddRange() [2/2]

template<typename Allocator >
template<typename OtherAllocator >
int32 TBitArray< Allocator >::AddRange ( const TBitArray< OtherAllocator > &  ReadBits,
int32  NumBitsToAdd,
int32  ReadOffsetBits = 0 
)
inline

Adds multiple bits read from the given BitArray.

参数
ReadBitsThe value to set the bits to.
NumBitsToAddThe number of bits to add. Must be >= 0.
ReadOffsetBitsNumber of bits into ReadBits at which to start reading. Must be >= 0.
返回
The index of the first added bit.

◆ AddUninitialized()

template<typename Allocator >
int32 TBitArray< Allocator >::AddUninitialized ( int32  NumBitsToAdd)
inline

Inserts space for multiple bits at the end of the array.

The inserted bits are set to arbitrary values and should be written using SetRange or otherwise before being read.

参数
NumBitsToAddThe number of bits to add. Must be >= 0.

◆ BitwiseAND()

template<typename Allocator >
static TBitArray TBitArray< Allocator >::BitwiseAND ( const TBitArray< Allocator > &  A,
const TBitArray< Allocator > &  B,
EBitwiseOperatorFlags  InFlags 
)
inlinestatic

Return the bitwise AND of two bit arrays.

The resulting bit array will be sized according to InFlags.

◆ BitwiseOR()

template<typename Allocator >
static TBitArray TBitArray< Allocator >::BitwiseOR ( const TBitArray< Allocator > &  A,
const TBitArray< Allocator > &  B,
EBitwiseOperatorFlags  InFlags 
)
inlinestatic

Return the bitwise OR of two bit arrays.

The resulting bit array will be sized according to InFlags.

◆ BitwiseXOR()

template<typename Allocator >
static TBitArray TBitArray< Allocator >::BitwiseXOR ( const TBitArray< Allocator > &  A,
const TBitArray< Allocator > &  B,
EBitwiseOperatorFlags  InFlags 
)
inlinestatic

Return the bitwise XOR of two bit arrays.

The resulting bit array will be sized according to InFlags.

◆ CombineWithBitwiseAND()

template<typename Allocator >
TBitArray & TBitArray< Allocator >::CombineWithBitwiseAND ( const TBitArray< Allocator > &  InOther,
EBitwiseOperatorFlags  InFlags 
)
inline

Perform a bitwise AND on this bit array with another.

This array receives the result and will be sized max(A.Num(), B.Num()).

◆ CombineWithBitwiseOR()

template<typename Allocator >
TBitArray & TBitArray< Allocator >::CombineWithBitwiseOR ( const TBitArray< Allocator > &  InOther,
EBitwiseOperatorFlags  InFlags 
)
inline

Return the bitwise OR of two bit arrays.

The resulting bit array will be sized according to InFlags.

◆ CombineWithBitwiseXOR()

template<typename Allocator >
TBitArray & TBitArray< Allocator >::CombineWithBitwiseXOR ( const TBitArray< Allocator > &  InOther,
EBitwiseOperatorFlags  InFlags 
)
inline

Return the bitwise XOR of two bit arrays.

The resulting bit array will be sized according to InFlags.

◆ CompareSetBits()

template<typename Allocator >
bool TBitArray< Allocator >::CompareSetBits ( const TBitArray< Allocator > &  Other,
const bool  bMissingBitValue 
) const
inline

Returns true if Other contains all the same set bits as this, accounting for differences in length.

Similar to operator== but can handle different length arrays by zero or one-filling missing bits.

参数
OtherThe array to compare against
bMissingBitValueThe value to use for missing bits when considering bits that are outside the range of either array
返回
true if this array matches Other, including any missing bits, false otherwise

◆ Empty()

template<typename Allocator >
void TBitArray< Allocator >::Empty ( int32  ExpectedNumBits = 0)
inline

Removes all bits from the array, potentially leaving space allocated for an expected number of bits about to be added.

参数
ExpectedNumBits- The expected number of bits about to be added.

◆ Find()

template<typename Allocator >
int32 TBitArray< Allocator >::Find ( bool  bValue) const
inline

Finds the first true/false bit in the array, and returns the bit index.

If there is none, INDEX_NONE is returned.

◆ FindAndSetFirstZeroBit()

template<typename Allocator >
int32 TBitArray< Allocator >::FindAndSetFirstZeroBit ( int32  ConservativeStartIndex = 0)
inline

Finds the first zero bit in the array, sets it to true, and returns the bit index.

If there is none, INDEX_NONE is returned.

◆ FindAndSetLastZeroBit()

template<typename Allocator >
int32 TBitArray< Allocator >::FindAndSetLastZeroBit ( )
inline

Finds the last zero bit in the array, sets it to true, and returns the bit index.

If there is none, INDEX_NONE is returned.

◆ FindLast()

template<typename Allocator >
int32 TBitArray< Allocator >::FindLast ( bool  bValue) const
inline

Finds the last true/false bit in the array, and returns the bit index.

If there is none, INDEX_NONE is returned.

◆ GetAllocatedSize()

template<typename Allocator >
uint32 TBitArray< Allocator >::GetAllocatedSize ( void  ) const
inline

Helper function to return the amount of memory allocated by this container

返回
number of bytes allocated by this container

◆ GetRange()

template<typename Allocator >
template<typename InWordType >
FORCEINLINE void TBitArray< Allocator >::GetRange ( int32  Index,
int32  NumBitsToGet,
InWordType *  WriteBits,
int32  WriteOffsetBits = 0 
) const
inline

Reads a range of bits within the array and writes them to the given pointer.

参数
IndexThe index of the first bit to read; must be 0 <= Index <= Num().
NumBitsToGetThe number of bits to read, must satisify 0 <= NumBitsToGet && Index + NumBitsToGet <= Num().
WriteBitsThe address of sized integers to write the bits to. Bits are written into WriteBits in the current platform's mathematical bitorder (WriteBits[0] & 0x1, WriteBits[0] & 0x2, ... WriteBits[0] & 0x100, ... WriteBits[0] & 0x80000000, WriteBits[1] & 0x1 ...
WriteOffsetBitsNumber of bits into WriteBits at which to start writing.

◆ Init()

template<typename Allocator >
FORCEINLINE void TBitArray< Allocator >::Init ( bool  bValue,
int32  InNumBits 
)
inline

Resets the array's contents.

Use TBitArray(bool bValue, int32 InNumBits) instead of default constructor and Init().

参数
Value- The value to initial the bits to.
NumBits- The number of bits in the array.

◆ Insert() [1/2]

template<typename Allocator >
void TBitArray< Allocator >::Insert ( bool  Value,
int32  Index 
)
inline

Adds a bit with the given value at the given index in the array.

参数
ValueThe value of the bit to add
Index- The index at which to add; must be 0 <= Index <= Num().

◆ Insert() [2/2]

template<typename Allocator >
void TBitArray< Allocator >::Insert ( bool  Value,
int32  Index,
int32  NumBitsToAdd 
)
inline

Inserts multiple bits with the given value into the array, starting at the given Index.

参数
ValueThe value of the bits to add
IndexThe index at which to add; must be 0 <= Index <= Num().
NumBitsToAddThe number of bits to add. Must be >= 0.

◆ InsertRange() [1/2]

template<typename Allocator >
template<typename InWordType >
void TBitArray< Allocator >::InsertRange ( const InWordType *  ReadBits,
int32  Index,
int32  NumBitsToAdd,
int32  ReadOffsetBits = 0 
)
inline

Inserts multiple bits read from the given pointer, starting at the given index.

参数
ReadBitsThe address of sized integers to read the bits from. Bits are read from ReadBits in the current platform's mathematical bitorder (ReadBits[0] & 0x1, ReadBits[0] & 0x2, ... ReadBits[0] & 0x100, ... ReadBits[0] & 0x80000000, ReadBits[1] & 0x1 ...
IndexThe index at which to add; must be 0 <= Index <= Num().
NumBitsToAddThe number of bits to add. Must be >= 0.
ReadOffsetBitsNumber of bits into ReadBits at which to start reading.

◆ InsertRange() [2/2]

template<typename Allocator >
template<typename OtherAllocator >
void TBitArray< Allocator >::InsertRange ( const TBitArray< OtherAllocator > &  ReadBits,
int32  Index,
int32  NumBitsToAdd,
int32  ReadOffsetBits = 0 
)
inline

Inserts multiple bits read from the given BitArray into the array, starting at the given index.

参数
ReadBitsThe value to set the bits to.
IndexThe index at which to add; must be 0 <= Index <= Num().
NumBitsToAddThe number of bits to add. Must be >= 0.
ReadOffsetBitsNumber of bits into ReadBits at which to start reading.

◆ InsertUninitialized()

template<typename Allocator >
void TBitArray< Allocator >::InsertUninitialized ( int32  Index,
int32  NumBitsToAdd 
)
inline

Inserts space for multiple bits into the array, starting at the given index.

The inserted bits are set to arbitrary values and should be written using SetRange or otherwise before being read.

参数
IndexThe index at which to add; must be 0 <= Index <= Num().
NumBitsToAddThe number of bits to add. Must be >= 0.

◆ PadToNum()

template<typename Allocator >
int32 TBitArray< Allocator >::PadToNum ( int32  DesiredNum,
bool  bPadValue 
)
inline

Pad this bit array with the specified value to ensure that it is at least the specified length.

Does nothing if Num() >= DesiredNum.

参数
DesiredNumThe desired number of elements that should exist in the array.
bPadValueThe value to pad with (0 or 1)
返回
The number of bits that were added to the array, or 0 if Num() >= DesiredNum.

◆ RemoveAt()

template<typename Allocator >
void TBitArray< Allocator >::RemoveAt ( int32  BaseIndex,
int32  NumBitsToRemove = 1 
)
inline

Removes bits from the array.

参数
BaseIndex- The index of the first bit to remove.
NumBitsToRemove- The number of consecutive bits to remove.

◆ Reserve()

template<typename Allocator >
void TBitArray< Allocator >::Reserve ( int32  Number)
inline

Reserves memory such that the array can contain at least Number bits.

@Number The number of bits to reserve space for.

◆ SetRange()

template<typename Allocator >
FORCENOINLINE void TBitArray< Allocator >::SetRange ( int32  Index,
int32  NumBitsToSet,
bool  Value 
)
inline

Sets or unsets a range of bits within the array.

参数
IndexThe index of the first bit to set; must be 0 <= Index <= Num().
NumBitsToSetThe number of bits to set, must satisify Index + NumBitsToSet <= Num().
ValueThe value to set the bits to.

◆ SetRangeFromRange() [1/2]

template<typename Allocator >
template<typename InWordType >
void TBitArray< Allocator >::SetRangeFromRange ( int32  Index,
int32  NumBitsToSet,
const InWordType *  ReadBits,
int32  ReadOffsetBits = 0 
)
inline

Sets range of bits within the TBitArray to the values read out of a pointer.

参数
IndexThe index of the first bit to set; must be 0 <= Index <= Num().
NumBitsToSetThe number of bits to set, must satisify 0 <= NumBitsToSet && Index + NumBitsToSet <= Num().
ReadBitsThe address of sized integers to read the bits from. Bits are read from ReadBits in the current platform's mathematical bitorder (ReadBits[0] & 0x1, ReadBits[0] & 0x2, ... ReadBits[0] & 0x100, ... ReadBits[0] & 0x80000000, ReadBits[1] & 0x1 ...
ReadOffsetBitsNumber of bits into ReadBits at which to start reading.

◆ SetRangeFromRange() [2/2]

template<typename Allocator >
template<typename OtherAllocator >
FORCEINLINE void TBitArray< Allocator >::SetRangeFromRange ( int32  Index,
int32  NumBitsToSet,
const TBitArray< OtherAllocator > &  ReadBits,
int32  ReadOffsetBits = 0 
)
inline

Sets range of bits within this TBitArray to the values read out another TBitArray.

参数
IndexThe index of the first bit to set; must be 0 <= Index <= Num().
NumBitsToSetThe number of bits to set, must satisify 0 <= NumBitsToSet && Index + NumBitsToSet <= Num().
ReadBitsThe value to set the bits to.
ReadOffsetBitsNumber of bits into ReadBits at which to start reading.

该类的文档由以下文件生成: