04.07.2013 Views

Modélisation des systèmes temps-réel répartis embarqués pour la ...

Modélisation des systèmes temps-réel répartis embarqués pour la ...

Modélisation des systèmes temps-réel répartis embarqués pour la ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

23 begin<br />

<strong>Modélisation</strong> <strong>des</strong> <strong>systèmes</strong> <strong>temps</strong>-<strong>réel</strong> <strong>répartis</strong> <strong>embarqués</strong><br />

24 CORBA.ORB.Initialize ("ORB");<br />

25 if Argument_Count /= 1 then<br />

26 Put_Line ("usage : client |-i");<br />

27 return;<br />

28 end if;<br />

29<br />

30 -- Getting the CORBA.Object<br />

31<br />

32 CORBA.ORB.String_To_Object<br />

33 (CORBA.To_CORBA_String (Ada.Command_Line.Argument (1)), myecho);<br />

34<br />

35 -- Checking if it worked<br />

36<br />

37 if Echo.Is_Nil (myecho) then<br />

38 Put_Line ("main : cannot invoke on a nil reference");<br />

39 return;<br />

40 end if;<br />

41<br />

42 -- Sending message<br />

43<br />

44 Put_Line ("Start experiment");<br />

45<br />

46 loop<br />

47 Date_Start := Clock;<br />

48 Sent_Msg := 1;<br />

49<br />

50 for i in 1 .. 10000 loop<br />

51 Rcvd_Msg := Echo.echoInt (myecho, Sent_Msg + 1);<br />

52 end loop;<br />

53<br />

54 Date_End := Clock;<br />

55 E<strong>la</strong>psed_Time := Date_End - Date_Start;<br />

56 Put_Line ("E<strong>la</strong>psed time is : " & Duration’Image (E<strong>la</strong>psed_Time))<br />

;<br />

57 end loop;<br />

58<br />

59 exception<br />

60 when E : CORBA.Transient =><br />

61 dec<strong>la</strong>re<br />

62 Memb : CORBA.System_Exception_Members;<br />

63 begin<br />

64 CORBA.Get_Members (E, Memb);<br />

65 Put ("received exception transient, minor");<br />

66 Put (CORBA.Unsigned_Long’Image (Memb.Minor));<br />

67 Put (", completion status: ");<br />

68 Put_Line (CORBA.Completion_Status’Image (Memb.Completed));<br />

69<br />

70 end;<br />

71 end Client;<br />

Listing VIII.7 – Code source du client CORBA<br />

162 c○ 2007 Thomas Vergnaud

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!