TBLBitArray
BitArray container.
Definition
Unit: Blend2D
Properties
Name | Description |
---|---|
Bits | The bits in the bit array. |
Capacity | The capacity of the bit array in bits. |
Cardinality | The number of bits set in the bit array. |
Data | The bit data. |
IsEmpty | Whether the bit array is empty (has no content). |
Size | The size of the bit array in bits. |
WordCount | The number of bit words this bit array uses. |
Constructors
Name | Description |
---|---|
Assign | Copy constructor. |
Finalize | Destroys the bit array. |
Initialize | Creates an empty bit array. |
Operators
Name | Description |
---|---|
Equal(TBLBitArray, TBLBitArray) | Returns True if two bit arrays are equal (have the same contents). |
Equal(TBLBitArray, Pointer) | Used to compare against nil (empty bit array). |
GreaterThan | |
GreaterThanOrEqual | |
LessThan | |
LessThanOrEqual | |
NotEqual(TBLBitArray, TBLBitArray) | Returns True if two bit arrays are not equal (do not have the same contents). |
NotEqual(TBLBitArray, Pointer) | Used to compare against nil (empty bit array). |
Methods
Name | Description |
---|---|
AppendBit | Appends a bit ABitValue to the bit array. |
AppendWord | Appends a single word AWordValue to the bit array. |
AppendWords(PUInt32, Integer) | Appends whole words to the bit array. |
AppendWords(TArray<UInt32>) | Appends whole words to the bit array. |
AssignWords(PUInt32, Integer) | Replaces the content of the bit array by bits specified by AWordData of size AWordCount [the size is in UInt32 units]. |
AssignWords(TArray<UInt32>) | Replaces the content of the bit array by bits specified by AWordData . |
CardinalityInRange | Returns the number of bits set in the given [AStartBit, AEndBit) range. |
Clear | Clears the content of the bit array without releasing its dynamically allocated data, if possible. |
ClearBit | Sets a bit to False at the given ABitIndex . |
ClearRange | Sets bits in [AStartBit, EndBit) range to False. |
ClearWord | Sets bits starting from ABitIndex specified by AWordValue to False (zeros in ASordValue are ignored). |
ClearWords(Integer, PUInt32, UInt32) | Sets bits starting from ABitIndex specified by AWordData and AWordCount to False (zeros in AWordData are ignored). |
ClearWords(Integer, TArray<UInt32>) | Sets bits starting from ABitIndex specified by AWordData to False (zeros in AWordData are ignored). |
Compare | Compares this bit array with AOther and returns either -1 , 0 , or 1 . |
Equals | Returns whether this bit array and AOther are bitwise equal. |
FillRange | Fills bits in [AStartBit, AEndBit) range to True. |
FillWords(Integer, PUInt32, UInt32) | Fills bits starting from ABitIndex specified by AWordData and AWordCount to True (zeros in AWordData are ignored). |
FillWords(Integer, TArray<UInt32>) | Fills bits starting from ABitIndex specified by AWordData to True (zeros in AWordData are ignored). |
HasBit | Returns a bit-value at the given ABitIndex . |
HasBitsInRange | Returns whether the bit-set has at least on bit in the given [AStartBit, AEndbit) range. |
Intersects | Returns whether this bit array intersects with AOther . |
ReplaceBit | Replaces a bit in the bit array at the given ABitIndex to match ABitValue . |
ReplaceOp | Makes the bit array mutable with the intention to replace all bits of it. |
ReplaceWord | Replaces bits starting from ABitIndex to match the bits specified by AWordValue . |
ReplaceWords(Integer, PUInt32, UInt32) | Replaces bits starting from ABitIndex to match the bits specified by AWordData and AWordCount . |
ReplaceWords(Integer, TArray<UInt32>) | Replaces bits starting from ABitIndex to match the bits specified by AWordData . |
Reserve | Reserves ANumBits in the bit array (capacity would match ANumBits ) without changing its size. |
Reset | Clears the content of the bit array and releases its data. |
Resize | Resizes the bit array so its size matches ANumBits . |
SetBit | Sets a bit to True at the given ABitIndex . |
Shrink | Shrinks the capacity of the bit array to match the actual content with the intention to save memory. |
Subsumes | Returns whether this bit array subsumes AOther . |
Swap | Swaps the content of this bit array with the AOther bit array. |
Property Descriptions
Bits
The bits in the bit array.
property Bits[const AIndex: Integer]: Boolean read GetBit write SetBit; default
Type: Boolean
Exceptions
EBlend2DError
: Raised on failure.
Capacity
The capacity of the bit array in bits.
property Capacity: Integer read GetCapacity
Type: Integer
Cardinality
The number of bits set in the bit array.
property Cardinality: Integer read GetCardinality
Type: Integer
Data
The bit data.
property Data: PUInt32 read GetData
Type: PUInt32
IsEmpty
Whether the bit array is empty (has no content).
property IsEmpty: Boolean read GetIsEmpty
Type: Boolean
Size
The size of the bit array in bits.
property Size: Integer read GetSize
Type: Integer
WordCount
The number of bit words this bit array uses.
property WordCount: Integer read GetWordCount
Type: Integer
Constructor Descriptions
Assign
Copy constructor.
Performs weak copy of the data held by the ASrc
bit array.
constructor Assign(var ADest: TBLBitArray; const ASrc: TBLBitArray); inline
Parameters
ADest
: TBLBitArray
ASrc
: TBLBitArray
Exceptions
EBlend2DError
: Raised on failure.
Finalize
Destroys the bit array.
destructor Finalize(var ADest: TBLBitArray)
Parameters
ADest
: TBLBitArray
Exceptions
EBlend2DError
: Raised on failure.
Initialize
Creates an empty bit array.
constructor Initialize(out ADest: TBLBitArray)
Parameters
ADest
: TBLBitArray
Exceptions
EBlend2DError
: Raised on failure.
Operator Descriptions
Equal(TBLBitArray, TBLBitArray)
Returns True if two bit arrays are equal (have the same contents).
class operator Equal(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
Equal(TBLBitArray, Pointer)
Used to compare against nil
(empty bit array).
class operator Equal(const ALeft: TBLBitArray; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: Pointer
Returns
Boolean
GreaterThan(TBLBitArray, TBLBitArray)
class operator GreaterThan(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
GreaterThanOrEqual(TBLBitArray, TBLBitArray)
class operator GreaterThanOrEqual(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
LessThan(TBLBitArray, TBLBitArray)
class operator LessThan(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
LessThanOrEqual(TBLBitArray, TBLBitArray)
class operator LessThanOrEqual(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
NotEqual(TBLBitArray, TBLBitArray)
Returns True if two bit arrays are not equal (do not have the same contents).
class operator NotEqual(const ALeft, ARight: TBLBitArray): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: TBLBitArray
Returns
Boolean
NotEqual(TBLBitArray, Pointer)
Used to compare against nil
(empty bit array).
class operator NotEqual(const ALeft: TBLBitArray; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLBitArray
ARight
: Pointer
Returns
Boolean
Method Descriptions
AppendBit(Boolean)
Appends a bit ABitValue
to the bit array.
procedure AppendBit(const ABitValue: Boolean); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitValue
: Boolean
AppendWord(UInt32)
Appends a single word AWordValue
to the bit array.
procedure AppendWord(const AWordValue: UInt32); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AWordValue
: UInt32
AppendWords(PUInt32, Integer)
Appends whole words to the bit array.
procedure AppendWords(const AWordData: PUInt32; const AWordCount: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AWordData
: PUInt32
AWordCount
: Integer
AppendWords(TArray<UInt32>)
Appends whole words to the bit array.
procedure AppendWords(const AWordData: TArray<UInt32>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AWordData
: TArray<UInt32>
AssignWords(PUInt32, Integer)
Replaces the content of the bit array by bits specified by AWordData
of size AWordCount
[the size is in UInt32 units].
procedure AssignWords(const AWordData: PUInt32; const AWordCount: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AWordData
: PUInt32
AWordCount
: Integer
AssignWords(TArray<UInt32>)
Replaces the content of the bit array by bits specified by AWordData
.
procedure AssignWords(const AWordData: TArray<UInt32>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AWordData
: TArray<UInt32>
CardinalityInRange(Integer, Integer)
Returns the number of bits set in the given [AStartBit, AEndBit)
range.
function CardinalityInRange(const AStartBit, AEndBit: Integer): Integer; inline
Parameters
AStartBit
: Integer
AEndBit
: Integer
Returns
Integer
Clear
Clears the content of the bit array without releasing its dynamically allocated data, if possible.
procedure Clear; inline
Exceptions
EBlend2DError
: Raised on failure.
ClearBit(Integer)
Sets a bit to False at the given ABitIndex
.
procedure ClearBit(const ABitIndex: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
ClearRange(Integer, Integer)
Sets bits in [AStartBit, EndBit)
range to False.
procedure ClearRange(const AStartBit, AEndBit: Integer); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AStartBit
: Integer
AEndBit
: Integer
ClearWord(Integer, UInt32)
Sets bits starting from ABitIndex
specified by AWordValue
to False (zeros in ASordValue are ignored).
procedure ClearWord(const ABitIndex: Integer; const AWordValue: UInt32); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordValue
: UInt32
Remarks
This operation uses an AND_NOT
operator - bits in AWordData
are negated and then combined with AND operator with existing bits in bit array.
ClearWords(Integer, PUInt32, UInt32)
Sets bits starting from ABitIndex
specified by AWordData
and AWordCount
to False (zeros in AWordData are ignored).
procedure ClearWords(const ABitIndex: Integer; const AWordData: PUInt32; const AWordCount: UInt32); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: PUInt32
AWordCount
: UInt32
Remarks
This operation uses an AND_NOT
operator - bits in AWordData
are negated and then combined with AND operator with existing bits in bit array.
ClearWords(Integer, TArray<UInt32>)
Sets bits starting from ABitIndex
specified by AWordData
to False (zeros in AWordData are ignored).
procedure ClearWords(const ABitIndex: Integer; const AWordData: TArray<UInt32>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: TArray<UInt32>
Remarks
This operation uses an AND_NOT
operator - bits in AWordData
are negated and then combined with AND operator with existing bits in bit array.
Compare(TBLBitArray)
Compares this bit array with AOther
and returns either -1
, 0
, or 1
.
function Compare(const AOther: TBLBitArray): Integer; inline
Parameters
AOther
: TBLBitArray
Returns
Integer
Equals(TBLBitArray)
Returns whether this bit array and AOther
are bitwise equal.
function Equals(const AOther: TBLBitArray): Boolean; inline
Parameters
AOther
: TBLBitArray
Returns
Boolean
FillRange(Integer, Integer)
Fills bits in [AStartBit, AEndBit)
range to True.
procedure FillRange(const AStartBit, AEndBit: Integer); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AStartBit
: Integer
AEndBit
: Integer
FillWords(Integer, PUInt32, UInt32)
Fills bits starting from ABitIndex
specified by AWordData
and AWordCount
to True (zeros in AWordData are ignored).
procedure FillWords(const ABitIndex: Integer; const AWordData: PUInt32; const AWordCount: UInt32); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: PUInt32
AWordCount
: UInt32
Remarks
This operation uses an OR
operator - bits in AWordData
are combined with OR operator with existing bits in bit array.
FillWords(Integer, TArray<UInt32>)
Fills bits starting from ABitIndex
specified by AWordData
to True (zeros in AWordData are ignored).
procedure FillWords(const ABitIndex: Integer; const AWordData: TArray<UInt32>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: TArray<UInt32>
Remarks
This operation uses an OR
operator - bits in AWordData
are combined with OR operator with existing bits in bit array.
HasBit(Integer)
Returns a bit-value at the given ABitIndex
.
function HasBit(const ABitIndex: Integer): Boolean; inline
Parameters
ABitIndex
: Integer
Returns
Boolean
HasBitsInRange(Integer, Integer)
Returns whether the bit-set has at least on bit in the given [AStartBit, AEndbit)
range.
function HasBitsInRange(const AStartBit, AEndBit: Integer): Boolean; inline
Parameters
AStartBit
: Integer
AEndBit
: Integer
Returns
Boolean
Intersects(TBLBitArray)
Returns whether this bit array intersects with AOther
.
function Intersects(const AOther: TBLBitArray): Boolean; inline
Parameters
AOther
: TBLBitArray
Returns
Boolean
ReplaceBit(Integer, Boolean)
Replaces a bit in the bit array at the given ABitIndex
to match ABitValue
.
procedure ReplaceBit(const ABitIndex: Integer; const ABitValue: Boolean); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
ABitValue
: Boolean
ReplaceOp(Integer)
Makes the bit array mutable with the intention to replace all bits of it.
function ReplaceOp(const ANumBits: Integer): PUInt32; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ANumBits
: Integer
Returns
PUInt32
Remarks
All bits in the bit array will be set to zero.
ReplaceWord(Integer, UInt32)
Replaces bits starting from ABitIndex
to match the bits specified by AWordValue
.
procedure ReplaceWord(const ABitIndex: Integer; const AWordValue: UInt32); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordValue
: UInt32
Remarks
Replaced bits from bit array are not combined by using any operator, AWordValue
is copied as is, thus replaces fully the existing bits.
ReplaceWords(Integer, PUInt32, UInt32)
Replaces bits starting from ABitIndex
to match the bits specified by AWordData
and AWordCount
.
procedure ReplaceWords(const ABitIndex: Integer; const AWordData: PUInt32; const AWordCount: UInt32); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: PUInt32
AWordCount
: UInt32
Remarks
Replaced bits from bit array are not combined by using any operator, AWordData
is copied as is, thus replaces fully the existing bits.
ReplaceWords(Integer, TArray<UInt32>)
Replaces bits starting from ABitIndex
to match the bits specified by AWordData
.
procedure ReplaceWords(const ABitIndex: Integer; const AWordData: TArray<UInt32>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
AWordData
: TArray<UInt32>
Remarks
Replaced bits from bit array are not combined by using any operator, AWordData
is copied as is, thus replaces fully the existing bits.
Reserve(Integer)
Reserves ANumBits
in the bit array (capacity would match ANumBits
) without changing its size.
procedure Reserve(const ANumBits: Integer); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ANumBits
: Integer
Reset
Clears the content of the bit array and releases its data.
After reset the bit array content matches a default constructed instance.
procedure Reset; inline
Exceptions
EBlend2DError
: Raised on failure.
Resize(Integer)
Resizes the bit array so its size matches ANumBits
.
procedure Resize(const ANumBits: Integer); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ANumBits
: Integer
SetBit(Integer)
Sets a bit to True at the given ABitIndex
.
procedure SetBit(const ABitIndex: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ABitIndex
: Integer
Shrink
Shrinks the capacity of the bit array to match the actual content with the intention to save memory.
procedure Shrink; inline
Exceptions
EBlend2DError
: Raised on failure.
Subsumes(TBLBitArray)
Returns whether this bit array subsumes AOther
.
function Subsumes(const AOther: TBLBitArray): Boolean; inline
Parameters
AOther
: TBLBitArray
Returns
Boolean
Swap(TBLBitArray)
Swaps the content of this bit array with the AOther
bit array.
procedure Swap(var AOther: TBLBitArray); inline
Parameters
AOther
: TBLBitArray