Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --table ads file
- generic
- type Item is private;
- type Table_Array is array (Positive range <>) of Item;
- package Table is
- type Table_Type (Capacity: Positive) is limited private;
- function Size(T: Table_Type) return Natural;
- function Get_Table(T: Table_Type) return Table_Array;
- procedure Insert(T: in out Table_Type; I: in Item);
- generic
- with function Op( A: in Item ) return Boolean;
- procedure Table_Where (T: in Table_Type; TA: out Table_Array; N: out Natural);
- generic
- with function "<" ( A, B: Item ) return Boolean is <>;
- procedure Table_Sort ( T: in out Table_Type);
- private
- type Table_Type(Capacity: Positive ) is record
- datas: Table_Array(1..Capacity);
- size: Natural := 0;
- end record;
- end Table;
- --table adb file
- procedure Table_Where (T: in Table_Type; TA: out Table_Array; N: out Natural) is
- begin
- N:=0;
- for I in T'Range loop
- if Op(T(I)) then
- N:= N + 1;
- TA(N):= T(I);
- end if;
- end loop;
- end;
- procedure Table_Sort ( T: in out Table_Type) is
- procedure Sort is new TableSort(Item, Index, Table_Array,"<");
- begin
- Sort(T);
- end;
- --selects ads file
- with Table;
- generic
- type OldItem is private;
- type OldTable_Array is array (Positive range <>) of OldItem;
- type NewItem is private;
- type NewTable_Array is array (Positive range <>) of NewItem;
- with package OldTable_Type is new Table(OldItem , OldTable_Array);
- with package NewTable_Type is new Table(NewItem, NewTable_Array);
- with function Transfer (I: in OldItem) return NewItem;
- procedure Selects ( IT: in In_Table; OT: out Out_Table);
- --selects adb file
- procedure Selects ( IT: in In_Table; OT: out Out_Table) is
- begin
- OT := Transfer(IT);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement