2 //=============================================================================
6 * @author Source code used in TAO has been modified and adapted from thecode provided in the book
7 * @author "Advanced CORBA Programming with C++"by Michi Henning and Steve Vinoski. Copyright1999. Addison-Wesley
9 * @author MA. Used with permission ofAddison-Wesley.Modified for TAO by Mike Moran <mm4@cs.wustl.edu>
11 //=============================================================================
15 #include <ace/streams.h>
17 // The following header is #included automatically by ACE+TAO.
18 // Therefore, they don't need to be included explicitly.
19 //#include <iostream.h>
22 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
29 cerr
<< "Usage: client IOR_string" << endl
;
34 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
36 // Destringify argv[1]
37 CORBA::Object_var obj
= orb
->string_to_object (argv
[1]);
38 if (CORBA::is_nil (obj
.in ()))
40 cerr
<< "Nil Time reference" << endl
;
45 Time_var tm
= Time::_narrow (obj
.in ());
47 if (CORBA::is_nil (tm
.in ()))
49 cerr
<< "Argument is not a Time reference" << endl
;
54 cout
<< "Validating connection"<<endl
;
55 CORBA::PolicyList_var pols
;
56 tm
->_validate_connection (pols
.out ());
57 cout
<< "Succesfull " <<endl
;
60 TimeOfDay tod
= tm
->get_gmt ();
61 cout
<< "Time in Greenwich is "
62 << setw (2) << setfill ('0') << tod
.hour
<< ":"
63 << setw (2) << setfill ('0') << tod
.minute
<< ":"
64 << setw (2) << setfill ('0') << tod
.second
<< endl
;
66 catch (const CORBA::Exception
&x
)
68 x
._tao_print_exception ("Who is the culprit\n");
69 cerr
<< "Uncaught CORBA exception" << endl
;