Class T2DSparsePointerArray

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type T2DSparsePointerArray = class(TObject)

Description

T2DSparsePointerArray acts like a 2D array of pointers. It provides constant time access to its elements through the its Items property. However, when many of the elements are nil, it can use much less memory than an array.

Hierarchy

Overview

Fields

Private FData: TSparsePointerArray;
Private FQuantum: TSPAQuantum;

Methods

Private function GetIsValue(const Index1, Index2: NativeInt): boolean;
Private function GetItems(const Index1, Index2: NativeInt): Pointer;
Private procedure SetIsValue(const Index1, Index2: NativeInt; const Value: boolean);
Private procedure SetItems(const Index1, Index2: NativeInt; const Value: Pointer);
Public procedure Clear; virtual;
Public constructor Create(Quantum: TSPAQuantum);
Public destructor Destroy; override;

Properties

Public property IsValue[constIndex1,Index2:NativeInt]: boolean read GetIsValue write SetIsValue;
Public property Items[constIndex1,Index2:NativeInt]: Pointer read GetItems write SetItems;

Description

Fields

Private FData: TSparsePointerArray;

FData is used to hold pointers to TSparsePointerArrays.

Private FQuantum: TSPAQuantum;

FQuantum defines the section size. Once allocated, a section can store a number of pointers.

Methods

Private function GetIsValue(const Index1, Index2: NativeInt): boolean;

See IsValue.

Private function GetItems(const Index1, Index2: NativeInt): Pointer;

See Items.

Private procedure SetIsValue(const Index1, Index2: NativeInt; const Value: boolean);

See IsValue.

Private procedure SetItems(const Index1, Index2: NativeInt; const Value: Pointer);

See Items.

Public procedure Clear; virtual;

Clear removes all items from T2DSparsePointerArray.

Public constructor Create(Quantum: TSPAQuantum);

Create creates an instance of T2DSparsePointerArray.

Public destructor Destroy; override;

Destroy destroys the current instance of T2DSparsePointerArray. Do not call Destroy directly. Call Free instead.

Properties

Public property IsValue[constIndex1,Index2:NativeInt]: boolean read GetIsValue write SetIsValue;

IsValue can be read to see if the item at (Index1, Index2) is non-nil. Setting IsValue at (Index1, Index2) to False sets Items[Index1, Index2] to nil. Setting IsValue at (Index1, Index2) to True has no effect.

Public property Items[constIndex1,Index2:NativeInt]: Pointer read GetItems write SetItems;

Items provides access to the pointer stored at location Index1, Index2.


Generated by PasDoc 0.12.1 on 2013-05-13 15:42:03