TFPSMap

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Basic map object, used in generic maps

Declaration

Source position: fgl.pp line 248

Type
  TFPSMap = class (TFPSList)
  private
    FKeySize : Integer;
    FDataSize : Integer;
    FDuplicates : TDuplicates;
    FSorted : Boolean;
    FOnKeyPtrCompare : TFPSListCompareFunc;
    FOnDataPtrCompare : TFPSListCompareFunc;
    procedure SetSorted(Value: Boolean);
  protected
    function BinaryCompareKey(Key1: Pointer; Key2: Pointer) : Integer;
    function BinaryCompareData(Data1: Pointer; Data2: Pointer) : Integer;
    procedure SetOnKeyPtrCompare(Proc: TFPSListCompareFunc);
    procedure SetOnDataPtrCompare(Proc: TFPSListCompareFunc);
    procedure InitOnPtrCompare;  Virtual;
    procedure CopyKey(Src: Pointer; Dest: Pointer);  Virtual;
    procedure CopyData(Src: Pointer; Dest: Pointer);  Virtual;
    function GetKey(Index: Integer) : Pointer;
    function GetKeyData(AKey: Pointer) : Pointer;
    function GetData(Index: Integer) : Pointer;
    function LinearIndexOf(AKey: Pointer) : Integer;
    procedure PutKey(Index: Integer; AKey: Pointer);
    procedure PutKeyData(AKey: Pointer; NewData: Pointer);
    procedure PutData(Index: Integer; AData: Pointer);
  public
    constructor Create(AKeySize: Integer; ADataSize: Integer);
    function Add(AKey: Pointer; AData: Pointer) : Integer;
    function Add(AKey: Pointer) : Integer;
    function Find(AKey: Pointer; out Index: Integer) : Boolean;
    function IndexOf(AKey: Pointer) : Integer;
    function IndexOfData(AData: Pointer) : Integer;
    function Insert(Index: Integer) : Pointer;
    procedure Insert(Index: Integer; out AKey: Pointer; out AData: Pointer);
    procedure InsertKey(Index: Integer; AKey: Pointer);
    procedure InsertKeyData(Index: Integer; AKey: Pointer; AData: Pointer);
    function Remove(AKey: Pointer) : Integer;
    procedure Sort;
    procedure Sort(SortingAlgorithm: PSortingAlgorithm);
    Duplicates : TDuplicates;
    KeySize : Integer;
    DataSize : Integer;
    Keys[Index: Integer]: Pointer;
    Data[Index: Integer]: Pointer;
    KeyData[Key: Pointer]: Pointer; default;
    Sorted : Boolean;
    OnPtrCompare : TFPSListCompareFunc;
    OnKeyPtrCompare : TFPSListCompareFunc;
    OnDataPtrCompare : TFPSListCompareFunc;
  end
  ;

Description

TFPSMap can be used to create a map for any type T that does not require reference counting (such as interfaced objects). It will specialize to a map which is a generalized list with an arbitrary type as the list index (called the key).

This class should normally not be used directly, instead use one of the generic map objects such as TFPGMap .

Members

Member Type Visibility Description
Add Method public Add a key, value pair to the map.
BinaryCompareData Method protected
BinaryCompareKey Method protected
CopyData Method protected
CopyKey Method protected
Create Method public Create a new map with given key and data size.
Data Property public Indexed access to the locations of all data items
DataSize Property public Size (in bytes) for the data associated with keys
Duplicates Property public What to do with duplicate key values
FDataSize Field private
FDuplicates Field private
Find Method public Find data using the associated key
FKeySize Field private
FOnDataPtrCompare Field private
FOnKeyPtrCompare Field private
FSorted Field private
GetData Method protected
GetKey Method protected
GetKeyData Method protected
IndexOf Method public Index of key pointed to by AKey
IndexOfData Method public Index of data item AData
InitOnPtrCompare Method protected
Insert Method public Insert a new slot for key and associated data item in the list
InsertKey Method public Insert a key in the list
InsertKeyData Method public Insert a key and associated in the list
KeyData Property public Access to data locations using key
Keys Property public Indexed access to the locations of all keys
KeySize Property public Size (in bytes) for the key
LinearIndexOf Method protected
OnDataPtrCompare Property public Callback to compare 2 data items
OnKeyPtrCompare Property public Callback to compare 2 keys
OnPtrCompare Property public Alias for OnKeyPtrCompare
PutData Method protected
PutKey Method protected
PutKeyData Method protected
Remove Method public Remove a key/value pair from the map.
SetOnDataPtrCompare Method protected
SetOnKeyPtrCompare Method protected
SetSorted Method private
Sort Method public Sort the list according to key
Sorted Property public Is the map permanently sorted on key ?

Inheritance

Class Description
TFPSMap Basic map object, used in generic maps

See also

Name Description
Integer A signed 16-bits integer
Integer A signed 16-bits integer
Integer A signed 16-bits integer
Integer A signed 16-bits integer
TDuplicates
TDuplicates
TFPGMap Generic map
TFPSListCompareFunc Compare list items callback signature
TFPSListCompareFunc Compare list items callback signature
TFPSListCompareFunc Compare list items callback signature
TFPSListCompareFunc Compare list items callback signature
TFPSListCompareFunc Compare list items callback signature

results matching ""

    No results matching ""