AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Statisches array of Single (glFloat) - Exception
Thema durchsuchen
Ansicht
Themen-Optionen

Statisches array of Single (glFloat) - Exception

Ein Thema von Flips · begonnen am 28. Nov 2011 · letzter Beitrag vom 29. Nov 2011
 
Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.487 Beiträge
 
Delphi 12 Athens
 
#7

AW: Statisches array of Single (glFloat) - Exception

  Alt 29. Nov 2011, 09:05
Dann wird das aber etwas komplizierter:
Delphi-Quellcode:
interface

type
  THeapArray = array [0..3,0..65535] of Single;
  PHeapArray = ^THeapArray;

  IHeapArray = interface(IInterface)
    function GetHeapArray: PHeapArray;
    property HeapArray: PHeapArray read GetHeapArray;
  end;

  THeapRecord = record
  private
    FHeapArray: IHeapArray;
    function GetItems: PHeapArray;
  public
    property Items: PHeapArray read GetItems;
  end;

implementation

type
  THeapObject = class(TInterfacedObject, IHeapArray)
  private
    FItems: THeapArray;
  protected
    function GetHeapArray: PHeapArray;
  end;

{ THeapObject }

function THeapObject.GetHeapArray: PHeapArray;
begin
  Result := @FItems;
end;

{ THeapRecord }

function THeapRecord.GetItems: PHeapArray;
begin
  if not Assigned(FHeapArray) then
    FHeapArray := THeapObject.Create;

  Result := FHeapArray.HeapArray;
end;
Delphi-Quellcode:
procedure TForm1.ButtonTestClick(Sender: TObject);
var
  MyRecord: THeapRecord;
begin
  MyRecord.Items[2, 65000] := 1.456;

  ShowMessage(Format('Wert: %f', [MyRecord.Items[2, 65000]]));
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:03 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz