2 //=============================================================================
6 * This program gets the name of the Root POA and prints it out on
9 * @author Irfan Pyarali
11 //=============================================================================
14 #include "tao/PortableServer/PortableServer.h"
18 #include "ace/Log_Msg.h"
21 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
26 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
28 // Resolve the initial references for the name RootPOA thus getting
29 // an object of type CORBA::Object.
30 CORBA::Object_var obj
=
31 orb
->resolve_initial_references ("RootPOA");
33 // apply _narrow on the object of type CORBA::Object, to make it
34 // a POA class Object.
35 PortableServer::POA_var root_poa
=
36 PortableServer::POA::_narrow (obj
.in ());
38 // Get the name of the root POA.
39 CORBA::String_var poa_name
=
40 root_poa
->the_name ();
43 "The RootPOA is : %C\n",
48 catch (const CORBA::Exception
& ex
)
50 ex
._tao_print_exception ("Exception raised");