// Минимум средств, максимум возможностей
// TODO: выпилить нафиг
unit dhashmap_pedantic;

interface

type
PHashMap = ^THashMap;
THashMap = object
public type
  PValue = ^TValue;
  TValue = packed record
    P: Pointer;
    S: PtrUInt;
  end;

public type
  PTypeOperators = ^TTypeOperators;
  TTypeOperators = object
    constructor Init;
    destructor Done; virtual;
    procedure InitElement(constref V: TValue); virtual;
    procedure DeleteElement(constref V: TValue); virtual;
    procedure MoveElement(constref Src, Dst: TValue); virtual;
    procedure CopyElement(constref Src, Dst: TValue); virtual;
  end;

public type
  THashFunc: function (P: Pointer; S: SizeUInt; U: Pointer): Cardinal;

public type
  PNode = ^TNode;
  TNode = packed record
    Next: PNode;
    Key: TValue;
    Value: TValue;
  end;

private
  FCount: LongInt;
  FHashFunc: THashFunc;
  FTable: array of PNode;
  FFreeNodes: PNode;

public

  // ACTUAL methods
  constructor Init(HashFunc: THashFunc; TypeOperators: PTypeOperators = nil);
  destructor Done;
  procedure Add(constref Key, Value: TValue);
  function Get(constref Key: TValue): TValue;

end;

implementation

end.
