|
Apparatus
Version 1.3.0
ECS data-driven workflow for Unreal Engine.
|
A memory-efficient bit mask. More...
#include <BitMask.h>
Classes | |
| struct | Iterator |
| The bit mask iterator. More... | |
Public Member Functions | |
| int32 | Num () const |
| The current number of meaningful bits in the mask. More... | |
| FBitMask () | |
| Construct a new empty bit mask. More... | |
| FBitMask (const FBitMask &InBitMask) | |
| Copy-construct the bit mask. More... | |
| FBitMask (FBitMask &&InBitMask) | |
| Move-construct the bit mask. More... | |
| FBitMask (const int32 Capacity) | |
| Initialize a new instance of a mask with bit capacity. More... | |
| bool | At (const int32 Index) const |
| Get the bit flag at the specified index. More... | |
| bool | operator[] (const int32 Index) const |
| Get a bit element by its index. More... | |
| void | SetAt (const int32 Index, const bool Value) |
| Set a bit at a specific index. More... | |
| bool | IsNonZero () const |
| Check if there are any non-zero bits in the mask. More... | |
| EApparatusStatus | Trim () const |
| Trim the meaningless high groups. More... | |
| bool | IsAllZeroes () const |
| Check if all of the bits in the mask are zeroes or none. More... | |
| int32 | CountNonZeroGroups () const |
| Get the number of meaningful (non-zero) bit groups. More... | |
| EApparatusStatus | Set (FBitMask &&InBitMask) |
| Move the bit mask to this bit mask. More... | |
| EApparatusStatus | Set (const FBitMask &InBitMask) |
| Set this bit mask equal to another bit mask. More... | |
| FBitMask & | operator= (FBitMask &&InBitMask) |
| Move the bit mask. More... | |
| FBitMask & | operator= (const FBitMask &InBitMask) |
| Set this bit mask equal to another bit mask. More... | |
| int32 | DifferencesCount (const FBitMask &BitMask) const |
| Get the number of different bits in two masks. More... | |
| int32 | InclusionsCount (const FBitMask &BitMask) const |
| Get the number of included bits in two masks. More... | |
| bool | Includes (const FBitMask &BitMask) const |
| Does the mask has all of the bits set in the supplied mask. More... | |
| bool | IncludesPartially (const FBitMask &BitMask) const |
| Check if the mask has any of the bits set in the supplied mask. More... | |
| bool | Contains (const bool bit) const |
| Does a bit mask contain the specified bit? More... | |
| Iterator | begin () |
| Iterator | end () |
| int32 | IndexOf (const bool bit) const |
| Get the index of the first matching bit in the mask. More... | |
| void | EnsureGroupsNum (int32 InGroupsCount) |
| Ensure a bit group count. More... | |
| void | EnsureGroupsForBitAt (const int32 BitIndex) |
| Ensure that there is enough bit groups for an index. More... | |
| int32 | Max () const |
| Get the current maximum number of bits that can be stored without any additional allocations. More... | |
| void | Reserve (const int32 BitCapacity) |
| Reserve space for a given number of bits. More... | |
| void | Add (const bool Bit) |
| Add a bit to the end of the mask. More... | |
| void | Empty (const int32 Slack=0) |
| Empties the array. More... | |
| void | Reset (const int32 NewSize=0) |
| Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array. More... | |
| void | SetMasked (const FBitMask &Mask, const bool State) |
| Set the bits based on a mask. More... | |
| void | CopyTo (bool *Array, int32 Offset) const |
| Copy the bits to an array, with a specified offset. More... | |
| void | Insert (const int32 Index, const bool Bit) |
| Insert a bit at the specified index. More... | |
| void | Remove (const bool Bit) |
| Remove the first occurrence of the specified bit from the mask. More... | |
| void | RemoveAt (const int32 Index) |
| Remove the bit at the specified index. More... | |
| void | Erase (const int32 Index) |
| Remove an element at the specified index. More... | |
| void | CopyTo (TArray< bool > &OutArray, const int32 Offset=0) |
| Copy to an array with a supplied offset. More... | |
| FBitMask & | AndWith (const FBitMask &InMask) |
| And the bitmask with a given mask. More... | |
| FBitMask & | operator&= (const FBitMask &InMask) |
| And the bitmask with a given mask. More... | |
| FBitMask & | OrWith (const FBitMask &InMask) |
| Or the bitmask with a given mask. More... | |
| FBitMask & | operator|= (const FBitMask &InMask) |
| Or the bitmask with a given mask. More... | |
| FString | ToString () const |
| Convert the bit mask to a string representation. More... | |
| uint32 | CalcHash () const |
| Calculate the bit mask hash. More... | |
Public Attributes | |
| friend | Iterator |
Friends | |
| class | StaticConstructor |
| uint32 | GetTypeHash (const FBitMask &bm) |
| std::ostream & | operator<< (std::ostream &Str, const FBitMask &v) |
| bool | operator== (const FBitMask &a, const FBitMask &b) |
| bool | operator!= (const FBitMask &a, const FBitMask &b) |
| FBitMask | operator& (const FBitMask &a, const FBitMask &b) |
| FBitMask | operator| (const FBitMask &a, const FBitMask &b) |
A memory-efficient bit mask.
Please, not that this is not a bit array and serves different purposes.
|
inline |
Construct a new empty bit mask.
|
inline |
Copy-construct the bit mask.
|
inline |
Move-construct the bit mask.
|
inline |
Initialize a new instance of a mask with bit capacity.
| void FBitMask::Add | ( | const bool | Bit | ) |
Add a bit to the end of the mask.
|
inline |
Get the bit flag at the specified index.
| Index | The index of the bit to get. If it's out of the number of elements, false is returned. |
|
inline |
|
inline |
Calculate the bit mask hash.
| bool FBitMask::Contains | ( | const bool | bit | ) | const |
Does a bit mask contain the specified bit?
|
inline |
Copy the bits to an array, with a specified offset.
|
inline |
Copy to an array with a supplied offset.
|
inline |
Get the number of meaningful (non-zero) bit groups.
| int32 FBitMask::DifferencesCount | ( | const FBitMask & | BitMask | ) | const |
Get the number of different bits in two masks.
|
inline |
Empties the array.
It calls the destructors on held flags if needed.
| Slack | (Optional) The expected usage size in bits after empty operation. Default is 0. |
|
inline |
|
inline |
Ensure that there is enough bit groups for an index.
|
inline |
Ensure a bit group count.
|
inline |
Remove an element at the specified index.
| Index | An index of the element to erase. |
|
inline |
Does the mask has all of the bits set in the supplied mask.
The same as a bitwise A & B == B.
|
inline |
Check if the mask has any of the bits set in the supplied mask.
The same as a bitwise A & B != 0.
| int32 FBitMask::InclusionsCount | ( | const FBitMask & | BitMask | ) | const |
Get the number of included bits in two masks.
| int32 FBitMask::IndexOf | ( | const bool | bit | ) | const |
Get the index of the first matching bit in the mask.
| void FBitMask::Insert | ( | const int32 | Index, |
| const bool | Bit | ||
| ) |
Insert a bit at the specified index.
|
inline |
Check if all of the bits in the mask are zeroes or none.
|
inline |
Check if there are any non-zero bits in the mask.
|
inline |
Get the current maximum number of bits that can be stored without any additional allocations.
|
inline |
The current number of meaningful bits in the mask.
This value doesn't play any role when comparing the masks.
Set this bit mask equal to another bit mask.
|
inline |
Get a bit element by its index.
| void FBitMask::Remove | ( | const bool | Bit | ) |
Remove the first occurrence of the specified bit from the mask.
| void FBitMask::RemoveAt | ( | const int32 | Index | ) |
Remove the bit at the specified index.
| Index | The index of the bit to remove. |
|
inline |
Reserve space for a given number of bits.
|
inline |
Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array.
| NewSize | The expected usage size in bits after calling this function. |
|
inline |
Set this bit mask equal to another bit mask.
|
inline |
Move the bit mask to this bit mask.
|
inline |
Set a bit at a specific index.
|
inline |
Set the bits based on a mask.
| Mask | The mask to use. |
| State | The state to set. |
|
inline |
Convert the bit mask to a string representation.
|
inline |
Trim the meaningless high groups.
|
friend |
|
friend |
|
friend |
| friend FBitMask::Iterator |