Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma Ada_2022;
- with tuppleSpacePackage.RealTupples, Ada.Strings.Unbounded, Ada.Text_IO;
- use tuppleSpacePackage.RealTupples,
- tuppleSpacePackage, Ada.Strings.Unbounded, Ada.Text_IO;
- procedure Essai is
- A, B: Unbounded_String;
- T: String_String_Tupple;
- Z: Integer_Positive_String_Tupple;
- I: Integer;
- P: Positive;
- F: Unbounded_String;
- Space: RealTuppleSpace;
- type TestType is new tuppleSpacePackage.Tupple with record
- A: String (1..10) := (others => ' ');
- B: Integer := -10;
- end record;
- overriding procedure Copy_Into (A: Tupple'Class; B: out TestType);
- procedure Decode (T: TestType; A: out String; B: out Integer) is
- begin
- if A'Length >= 10 then
- A(A'First..A'First+9) := T.A;
- else
- A := T.A(T.A'First..T.A'First+A'Length-1);
- end if;
- B := T.B;
- end Decode;
- function Encode (A: String; B: Integer) return TestType is ("1234567890", B);
- procedure Copy_Into (A: Tupple'Class; B: out TestType) is
- begin
- B := TestType(A);
- end Copy_Into;
- E: Testtype;
- begin
- Space.Out_Operation (Encode ("111", "111"));
- Space.Out_Operation (Encode (-3,4, "Text"));
- Space.In_Operation (T);
- Decode (T, A, B);
- Put_line(To_String(A) & " " & To_string(B));
- begin
- Space.INP_Operation (T);
- exception when E: tuppleSpacePackage.No_Immediate_Message =>
- Put_line ("Caught");
- end;
- begin
- Space.RDP_Operation (T);
- exception when E: tuppleSpacePackage.No_Immediate_Message =>
- Put_line ("Caught");
- end;
- Space.In_Operation (Z);
- Space.Out_Operation (Encode ("222", "222"));
- Space.Out_Operation (Encode ("aaa", "aaa"));
- Space.In_Operation (T);
- Decode (T, A, B);
- Put_line(To_String(A) & " " & To_string(B));
- Space.In_Operation (T);
- Decode (T, A, B);
- Put_line(To_String(A) & " " & To_string(B));
- Decode (Z, I, P, F);
- Put_line (I'Image & P'Image & " " & To_String(F));
- Space.Out_Operation (Encode("je ne sai", -48));
- end Essai;
Advertisement
Add Comment
Please, Sign In to add comment