Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / POA / RootPOA / RootPOA.cpp
blob0d17d787ef57a73a44874bfc40474d8d9058f4a6
2 //=============================================================================
3 /**
4 * @file RootPOA.cpp
6 * This program gets the name of the Root POA and prints it out on
7 * the standard output.
9 * @author Irfan Pyarali
11 //=============================================================================
14 #include "tao/PortableServer/PortableServer.h"
16 #include "tao/ORB.h"
18 #include "ace/Log_Msg.h"
20 int
21 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
23 try
25 // Initilize the ORB
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 ();
42 ACE_DEBUG ((LM_DEBUG,
43 "The RootPOA is : %C\n",
44 poa_name.in ()));
46 orb->destroy ();
48 catch (const CORBA::Exception& ex)
50 ex._tao_print_exception ("Exception raised");
53 return 0;