Navigation
API > API/Runtime > API/Runtime/NetCore
Simple bit array with internal storage. Has very little error checking as it is used in performance critical code.
| Name | FNetBitArray |
| Type | class |
| Header File | /Engine/Source/Runtime/Net/Core/Public/Net/Core/NetBitArray.h |
| Include Path | #include "Net/Core/NetBitArray.h" |
Syntax
class FNetBitArray : public UE::Net::FNetBitArrayBase
Inheritance Hierarchy
- FNetBitArrayBase → FNetBitArray
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FNetBitArray () |
FNetBitArray Implementation. | Net/Core/NetBitArray.h | |
FNetBitArray
(
uint32 BitCount |
Creates an array with size BitCount bits. | Net/Core/NetBitArray.h | |
FNetBitArray
(
uint32 BitCountIn, |
Construct NetBitArray with the given BitCount but doesn't zero the allocated memory. | Net/Core/NetBitArray.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BitCount | uint32 | Net/Core/NetBitArray.h | ||
| Storage | TArray< StorageWordType > | Net/Core/NetBitArray.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddBits
(
uint32 BitCount |
Grows the size with the specified number of bits. New bits will be cleared. | Net/Core/NetBitArray.h | |
void AndBitValue
(
uint32 Index, |
Do an And operation on the specified index | Net/Core/NetBitArray.h | |
| FNetBitArrayRangedForConstIterator implementation. | Net/Core/NetBitArray.h | ||
void ClearAllBits() |
Clear all bits in the array. | Net/Core/NetBitArray.h | |
void ClearBit
(
uint32 Index |
Clear the bit with the specified index | Net/Core/NetBitArray.h | |
void ClearBits
(
uint32 StartIndex, |
Clear the bits in the specified range | Net/Core/NetBitArray.h | |
void Combine
(
const FNetBitArray& Other, |
Combine this array with another array using a word operation functor. Bit counts need to match. | Net/Core/NetBitArray.h | |
void CombineMultiple
(
WordOpFunctor1&& Op, |
Combine this array with the result of a bitwise operation of two other arrays. | Net/Core/NetBitArray.h | |
void Copy
(
const FNetBitArrayView& Other |
Net/Core/NetBitArray.h | ||
void Copy
(
const FNetBitArray& Other |
Copy bits from other bit array. The other array must have the same bit count. | Net/Core/NetBitArray.h | |
uint32 CountSetBits
(
uint32 StartIndex, |
Counts the number of set bits in this array in the provided range. | Net/Core/NetBitArray.h | |
void Empty() |
Release all memory and set capacity to 0 bits | Net/Core/NetBitArray.h | |
| Net/Core/NetBitArray.h | |||
uint32 FindFirstOne
(
uint32 StartIndex |
Find first set bit starting from StartIndex. Returns InvalidIndex if no set bit was found. | Net/Core/NetBitArray.h | |
uint32 FindFirstOne () |
Find first set bit. Returns InvalidIndex if no zero bit was found | Net/Core/NetBitArray.h | |
uint32 FindFirstZero () |
Find first zero bit. Returns InvalidIndex if no zero bit was found | Net/Core/NetBitArray.h | |
uint32 FindFirstZero
(
uint32 StartIndex |
Find first zero bit starting from StartIndex. Returns InvalidIndex if no zero bit was found. | Net/Core/NetBitArray.h | |
uint32 FindLastOne() |
Find last set bit. Returns InvalidIndex if no set bit was found. | Net/Core/NetBitArray.h | |
uint32 FindLastZero() |
Find last zero bit. Returns InvalidIndex if no zero bit was found. | Net/Core/NetBitArray.h | |
void ForAllSetBits
(
T&& Functor |
Iterate over all set bits and invoke functor with signature void(uint32 BitIndex). | Net/Core/NetBitArray.h | |
void ForAllUnsetBits
(
T&& Functor |
Iterate over all the zero bits and invoke functor with signature void(uint32 BitIndex). | Net/Core/NetBitArray.h | |
bool GetBit
(
uint32 Index |
Get the bit with the specified index | Net/Core/NetBitArray.h | |
const StorageWordType * GetData () |
Returns a pointer to the internal storage. It's safer to use GetWord() or GetDataChecked() instead. | Net/Core/NetBitArray.h | |
StorageWordType * GetData () |
Returns a pointer to the internal storage. It's safer to use GetWord() or GetDataChecked() instead. | Net/Core/NetBitArray.h | |
StorageWordType * GetDataChecked
(
uint32 MaxWordIterationCount |
Returns a pointer to the internal storage but validates that the array buffer is the expected size. | Net/Core/NetBitArray.h | |
const StorageWordType * GetDataChecked
(
uint32 MaxWordIterationCount |
Returns a pointer to the internal storage but validates that the array buffer is the expected size. | Net/Core/NetBitArray.h | |
uint32 GetNumBits() |
Returns the number of bits | Net/Core/NetBitArray.h | |
uint32 GetNumWords() |
Returns the number of words in our storage | Net/Core/NetBitArray.h | |
uint32 GetSetBitIndices
(
uint32 StartIndex, |
Retrieves set bits in the provided range and returns how many indices were written to OutIndices. | Net/Core/NetBitArray.h | |
StorageWordType GetWord
(
uint32 WordIndex |
Read an entire word. Useful when you want to read 'WordBitCount(32)' bits at once | Net/Core/NetBitArray.h | |
StorageWordType & GetWord
(
uint32 WordIndex |
Access an entire word. Useful when you want to write 'WordBitCount(32)' bits at once | Net/Core/NetBitArray.h | |
void Init
(
uint32 BitCount |
Sets a new size and resets the array's contents. | Net/Core/NetBitArray.h | |
void InitAndCopy
(
const FNetBitArray& Source |
Initialize a bit array with another array. | Net/Core/NetBitArray.h | |
void InitAndCopy
(
const FNetBitArrayView& Source |
Net/Core/NetBitArray.h | ||
bool IsAnyBitSet
(
uint32 StartIndex, |
Returns true if any bit is set in the specified range. | Net/Core/NetBitArray.h | |
bool IsAnyBitSet () |
Returns true if any bit is set in the bitset. | Net/Core/NetBitArray.h | |
bool IsBitSet
(
uint32 Index |
Return if a specified bit is set or not | Net/Core/NetBitArray.h | |
bool IsNoBitSet() |
Returns true if no bit is set in the bitset. Note: Padding bits in storage are expected to be zero. | Net/Core/NetBitArray.h | |
void OrBitValue
(
uint32 Index, |
Do an Or operation on the specified index | Net/Core/NetBitArray.h | |
void Reset() |
Clear all bits in the array. | Net/Core/NetBitArray.h | |
void Set
(
const FNetBitArray& First, |
Overwrite this bit array with the result of a word operation from two other arrays | Net/Core/NetBitArray.h | |
void SetAllBits() |
Sets all bits in the array, but clears padding bits. | Net/Core/NetBitArray.h | |
void SetBit
(
uint32 Index |
Set the bit with the specified index | Net/Core/NetBitArray.h | |
void SetBits
(
uint32 StartIndex, |
Set the bit with the specified index to bValue | Net/Core/NetBitArray.h | |
void SetBitValue
(
uint32 Index, |
Set the bit with the specified index to bValue | Net/Core/NetBitArray.h | |
void SetNumBits
(
uint32 BitCount |
Sets the number of bits to BitCount. | Net/Core/NetBitArray.h | |
FString ToString () |
Only prints the amount of set bits in the array. | Net/Core/NetBitArray.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void ForAllExclusiveBits
(
const FNetBitArray& A, |
Compare two BitArrays bit by bit and invoke FunctorA(BitIndex) for bits set only in array A and invoke FunctorB(BitIndex) for bits set only in array B. | Net/Core/NetBitArray.h | |
static void ForAllExclusiveBitsByPredicate
(
const FNetBitArray& A, |
Compare two BitArrays bit by bit. | Net/Core/NetBitArray.h | |
static void ForAllSetBits
(
const FNetBitArray& A, |
Iterate over all words and execute Functor, with signature void(uint32 BitIndex), for all set bits after executing WordOpFunctor | Net/Core/NetBitArray.h | |
static void ForAllSetBitsMultiple
(
const FNetBitArray& A, |
Call the functor for every bit still set after the following operation: "A Op1 (B Op2 C)" | Net/Core/NetBitArray.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool operator==
(
const FNetBitArray& Other |
Return true if equal including BitCount and padding bits | Net/Core/NetBitArray.h |