When you indicate that a generic parameter is a private type, well, Ada assumes you mean this :-)
.. . " duck typed", , , . ( , Checksum , The_Transfer_Type , , Integer?)
- , , . :.
generic
type The_Transfer_Type is private;
with function Get_Checksummable_Data_Item
(Msg : The_Transfer_Type;
I : Integer) return Integer;
SIZE : Integer;
package CC_Test_Channel is
function Checksum(Msg : The_Transfer_Type) return Integer;
end CC_Test_Channel;
:
function Checksum(Msg : The_Transfer_Type) return Integer is
Sum : Integer := 0;
begin
for i in 1 .. SIZE loop
Sum := Sum + Get_Checksummable_Data(Msg, I);
end loop;
return Sum;
end Checksum;
, Get_Checksummable_Data, The_Transfer_Type The_Transfer_Type.
, , - SIZE, Checksum() , CC_Test_Channel, :
with function Calculate_Checksum(Msg : The_Transfer_Type) return Integer;
.
...