[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPGMapInterfacedObjectData

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

Generic map for reference counted objects

## Declaration

Source position: fgl.pp line 390

`type generic TFPGMapInterfacedObjectData <TKey,TData>= class(TFPSMap)`
`public`
`constructor Create;` |  | Create a new instance of the map
`function Add();` |  | Add a key and value to the map
`function Find();` |  | Find item based on key
`function TryGetData();` |  | Find data or return default
`procedure AddOrSetData();` |  | Add data with given or set value if the key already exists.
`function IndexOf();` |  | Find index of a key in the list.
`function IndexOfData();` |  | Find index of data value in the list.
`procedure InsertKey();` |  | Insert a new key in the list
`procedure InsertKeyData();` |  | Insert a new key with associated data in the list
`function Remove();` |  | Remove a key from the list
`property Keys []: TKey; [rw]` |  | Indexed access to the keys in the list.
`property Data []: TData; [rw]` |  | Indexed access to the data in the list
`property KeyData []: TData; default; [rw]` |  | Access to data based on key
`property OnCompare: TKeyCompareFunc; [rw]` |  | Alias for OnKeyCompare
`property OnKeyCompare: TKeyCompareFunc; [rw]` |  | Compare function for key values.
`property OnDataCompare: TDataCompareFunc; [rw]` |  | Compare function for data values.
`end;`

## Inheritance

`TFPGMapInterfacedObjectData` |  | Generic map for reference counted objects
`TFPSMap` |  | Basic map object, used in generic maps
`TFPSList` |  | Basic list of memory blocks
`TObject` |  | Base class of all classes.

## Description

TFPGInterfacedObjectMap is a generic map class. It can be used to specialize a map for any key type, with associated data type that requires manual reference counting: any type which implements IInterface. For non-reference counted objects, TFPGMap should be used.

This map class is entirely equivalent to TFPGMap, but operates on data items that require additional reference counting code on the data.

## See also

TFPGMap |  | Generic map