unit class_point;

interface

uses class_param, user_types, class_rd_image, class_UI_values, class_basics;

const PICTURES_DLL_NAME = 'pictures.dll';

{$REGION 'ÊËÀÑÑ "ÒÎ×ÊÀ"'}
type
  TRDPoint = class (TRD_Something)
    private

    public
      image: TRDPointImage;

      U_Values: TRDValue_UI;
      I_Values: TRDValue_UI;

      Params: TRDParamList;

      constructor Create ( in_point_name, in_point_desc: string); override;
      destructor Destroy; override;
end;
{$ENDREGION}

type
  TRDPointList = class (TRD_List)
    private
      function set_current_point (in_point_index: integer): boolean;
    public
      function Find_by_name( in_object_name: string ): TRDPoint;
      function Next_point: TRDPoint;
      function Prev_point: TRDPoint;
      function First_point: TRDPoint;
      function Last_point: TRDPoint;
      function Get_current_point: TRDPoint;
      function Find_by_index (in_index: integer): TRDPoint;
      function Add (in_point: TRDPoint):integer; virtual;

end;


implementation
{$REGION 'ÊËÀÑÑ "ÒÎ×ÊÀ" ÐÅÀËÈÇÀÖÈß'}
constructor TRDPoint.Create;
begin
Assert( ( in_point_name <> '' ),
        'Âõîäíîå ïîëå ÈÌß ÒÎ×ÊÈ êëàññà RDPoint ïóñòîå!'+'{3E287545-CFD4-47F1-A439-3D7D7B600877}');
  inherited Create(in_point_name, in_point_desc);
  self.Params := TRDParamList.Create;

  self.image := TRDPointImage.Create( PICTURES_DLL_NAME, in_point_name );
  self.U_Values := TRDValue_UI.Create;
  self.I_Values := TRDValue_UI.Create;
end;

destructor TRDPoint.Destroy;
begin
  self.Params.Free;
  self.image.Free;
  self.U_Values.Free;
  self.I_Values.Free;
  inherited Destroy;
end;
{$ENDREGION}

{ TRDPointList }

function TRDPointList.Add(in_point: TRDPoint): integer;
var inserted_num: integer;
begin
  inserted_num := inherited add(in_point);
  self.set_current_point( inserted_num );
  result := inserted_num;
end;

function TRDPointList.Find_by_index(in_index: integer): TRDPoint;
begin
  result := inherited Find_by_index( in_index ) as TRDPoint;
end;

function TRDPointList.Find_by_name(in_object_name: string): TRDPoint;
begin
  result := inherited Find_by_name(in_object_name) as TRDPoint;
end;

function TRDPointList.First_point: TRDPoint;
begin
  result := inherited First_item as TRDPoint;
end;

function TRDPointList.Get_current_point: TRDPoint;
begin
  result := inherited Get_current_item as TRDPoint;
end;

function TRDPointList.Last_point: TRDPoint;
begin
  result := inherited Last_item as TRDPoint;
end;

function TRDPointList.Next_point: TRDPoint;
begin
  result := inherited Next_item as TRDPoint;
end;

function TRDPointList.Prev_point: TRDPoint;
begin
  result := inherited Prev_item as TRDPoint;
end;

function TRDPointList.set_current_point(in_point_index: integer): boolean;
begin
  result := inherited set_current_item ( in_point_index );
end;

end.
