Программирование - это просто
Advertisement
arrow arrow arrow PASSBaseObj 1.4
06.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
PASSBaseObj 1.4 E-mail
megabax   
06.12.2010 .

() www.easyprog.ru

PASSBaseObj 1.4

.

 

:

TPASSAbstractDataSource .

TPASSDataSource .

TPASSBufferedDataSource .

TPASSStreamBufferedDataSource , .

TPASSStreamTimedBufferedDataSource , , , , .

TPASSPriceSource .

 

.

 

TPASSAbstractDataSource.

TPASSAbstractDataSource=Class(TObject)
private
    FFields:TStringList;
public
    property Fields:TStringList read FFields;
    function GetFieldNum(AFieldName:string):integer;
end;

GetFieldNum , .

Fields . , .

TPASSDataSource

TPASSDataSource=Class(TPASSAbstractDataSource)
 private
     FActive:boolean;
     FCurrentItemIndex:LongInt;
     FCountLoadedBars:LongInt;
     procedure SetActive(AActive:boolean); virtual; abstract;
     procedure SetCurrentItemIndex(ACurrenItemIndex:LongInt); virtual; abstract;
 public
     Property Active:Boolean Read FActive Write SetActive;
     Property CurrentItemIndex:LongInt Read FCurrentItemIndex Write SetCurrentItemIndex;
     Property CountLoadedBars:LongInt Read FCountLoadedBars;
     Function NextItem:boolean; virtual; abstract;
     Function PrevItem:boolean; virtual; abstract;
     Procedure First; virtual; abstract;
     Procedure Last; virtual; abstract;
     Function GetDataByFieldName(AFieldName:String):Double; virtual; abstract;
     Function GetDataByFieldNum(AFieldNum:integer) :Double; virtual; abstract;
     Function GetDataByFieldNameAndIndex(AFieldName:String;Index:LongInt):Double; virtual; abstract;
     Function GetDataByFieldNumAndIndex(AFieldNum:integer;Index:LongInt):Double; virtual; abstract;
 end;

 

Active , . .

CurrentItemIndex - .

CountLoadedBars - . .

NextItem, PrevItem, First, Last .

GetDataByFieldName, GetDataByFieldNum, GetDataByFieldNameAndIndex, GetDataByFieldNumAndIndex - . GetDataByFieldName, GetDataByFieldNum - , GetDataByFieldNameAndIndex, GetDataByFieldNumAndIndex - .

TPASSBufferedDataSource

 

  TPASSBufferedDataSource=Class(TPASSDataSource)

  private

    FBuffer:PBufferArray;

    FPointerSize:LongInt;

    procedure SetCurrentItemIndex(ACurrentItemIndex:LongInt); override;

  public

    Property PointerSize:LongInt Read FPointerSize Write FPointerSize;

    Function NextItem:boolean; override;

    Function PrevItem:boolean; override;

    Function Add:Boolean; virtual;

    Procedure First; override;

    Procedure Last; override;

    Procedure FillGrid(AGrid: TStringGrid; AFields:TStringList);

  end;

 

PointerSize .

Add CurrentItemIndex .

FillGrid TStringGrid (, , ).

 

TPASSStreamBufferedDataSource

 

  TPASSStreamBufferedDataSource=class(TPASSBufferedDataSource)

  private

    procedure SaveHeader(AStream:TStream); virtual;

    procedure LoadHeader(AStream:TStream); virtual;

  end;

 

TPASSStreamTimedBufferedDataSource

 

  TPASSStreamTimedBufferedDataSource=class(TPASSStreamBufferedDataSource)

  public

    function SearchIndexAsDate(ADateTime:TDateTime):integer;

  end;

 

SearchIndexAsDate . , CurrentItemIndex 1. ,   , , -1 . , 0. .

 

TPASSPriceSource

 

.

  TPASSPriceSource=Class(TPASSBufferedDataSource)

  private

    FFilePath:string;

    FTiker:string;

    FPeriod:string;

    FStream:TStream;

    FHaveHeader, FHaveTicker, FHavePer:boolean;

    FName:string;

    procedure SetActive(AActive:boolean); virtual;

    procedure SetFilePath(AFilePath:string);

    function GetSignature:Str3;

    function GetVersion:real;

    procedure ShiftBufferRight(index,count:LongInt);

  public

    property Name:string read FName write FName;

    property Active:Boolean Read FActive Write SetActive;

    constructor Create(AFilePath:string;AActive:boolean);

    property FilePath:string Read FFilePath Write SetFilePath;

    property Tiker:string read FTiker write FTiker;

    property Period:string read FPeriod;

    property Stream:TStream read FStream;

    destructor Destroy; override;

    procedure SetBarData(ABarData:TBarStructure); virtual;

    function GetBarData:TBarStructure; virtual;

    function GetBarDataByIndex(Index:LongInt):TBarStructure; virtual;

    function GetDataByFieldName(AFieldName:String):Double; virtual;

    function GetDataByFieldNum(AFieldNum:integer) :Double; virtual;

    function GetDataByFieldNameAndIndex(AFieldName:String;Index:LongInt):Double; virtual;

    function GetDataByFieldNumAndIndex(AFieldNum:integer;Index:LongInt):Double; virtual;

    function SearchIndexAsDate(ADateTime:TDateTime):integer;

    procedure LoadDataFromTextFile(AFilePath:string);

    procedure LoadBarFromTextFile(var AStruct:TBarStructure; var VF:TextFile);

    procedure LoadDataFromStream(AStream:TStream);

    procedure LoadBarFromStream(var AStruct:TBarStructure; AStream:TStream);

    procedure SaveDataToStream(AStream:TStream);

    procedure SaveBarToStream(AStruct:TBarStructure; AStream:TStream);

    procedure SaveBarToTextFile(var VF:TextFile; AStruct:tBarStructure);

    procedure SaveDataToTextFile(AFilePath:string);

    procedure SaveAllData;

    function  InsertBarData(ABarData:TBarStructure):boolean; virtual;

    function  InsertEmptyBarBefore(index:LongInt):boolean; virtual;

    procedure Delete(index:LongInt);

  end;

 

Name , .

Create ( ) .

FilePath ( ).

Tiker . EESR.   . , Tiker, Tiker .

  Period . , . . :

M

W

D

60

30 .

30

15 .

15

10 .

10

5 .

5

1 .

1

0

 

. PerPrToStr StrToPerPr.

Stream . TFileStream. .

SetBarData .

GetBarData .

GetBarDataByIndex  - .

NextItem, PrevItem, First, Last .

GetDataByFieldName, GetDataByFieldNum, GetDataByFieldNameAndIndex, GetDataByFieldNumAndIndex - . GetDataByFieldName, GetDataByFieldNum - , GetDataByFieldNameAndIndex, GetDataByFieldNumAndIndex - .

LoadDataFromTextFile . .

LoadBarFromTextFile AStruct.

LoadDataFromStream . .

LoadBarFromStream   AStruct.

SaveDataToStream .

SaveBarToStream .

SaveBarToTextFile .

SaveDataToTextFile .

SaveAllData , FilePath.

InsertBarData . , . .

InsertEmptyBarBefore , .

  Delete .

 

 

 

( 06.12.2010 . )
 
. »
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .