//
//  Map: Red-black tree
//

{$I d_checks.inc}

{$IF Defined(D_INTERFACE)}
type
{$IFDEF D_USE_GENERIC}
generic D_COLLECTION<
  {$IFDEF D_KEY_SIZE_STATIC}TKey,{$ENDIF}
  {$IFDEF D_VALUE_SIZE_STATIC}TValue,{$ENDIF}
  {$IFDEF D_ALLOCATOR_STATIC}TAllocator,{$ENDIF}
  TDummy> = object
{$ELSE}
D_COLLECTION = object
{$ENDIF}
public type
  // Pointer to the structure
  TPtr = ^D_COLLECTION;
  // Pointers to keys and values
  PKey = ^TKey;
  PValue = ^TValue;
  // Node of the tree
  PNode = ^TNode;
  TNode = record
    Key: TKey;
    {$IF Defined(D_KEY_SIZE_DYNAMIC)} KeyLength: SizeUInt{$ENDIF}
    Value: TValue;
    {$IF Defined(D_KEY_SIZE_DYNAMIC)} ValueLength: SizeUInt{$ENDIF}
    Left: PNode;
    Right: PNode;
    Red: Boolean;
  end;
private
  {$IF Defined(D_ALLOCATOR_STATIC)}FAllocator: Pointer;{$ENDIF}
end;
{$ENDIF}

{$IF Defined(D_IMPLEMENTATION)}
{$ENDIF}
