3 #include <omg/PortableServer.hh>
5 #include "Server_ORBInitializer.h"
7 const char* ior_output_file
= "test.ior";
9 //FUZZ: disable check_for_improper_main_declaration
11 main(int argc
, char* argv
[])
15 PortableInterceptor::ORBInitializer_var initializer
= new Server_ORBInitializer();
17 PortableInterceptor::register_orb_initializer (initializer
.in ());
19 // Now we can create the ORB
21 CORBA::ORB_init (argc
, argv
, "taodemo");
23 CORBA::Object_var poa_object
=
24 orb
->resolve_initial_references ("RootPOA");
26 assert(!CORBA::is_nil (poa_object
.in ()));
28 PortableServer::POA_var root_poa
=
29 PortableServer::POA::_narrow (poa_object
.in ());
31 PortableServer::POAManager_var poa_manager
=
32 root_poa
->the_POAManager ();
34 poa_manager
->activate ();
36 CDR_Out_Arg_i
server_impl(orb
.in ());
38 PortableServer::ObjectId_var id
=
39 root_poa
->activate_object (&server_impl
);
41 CORBA::Object_var test_obj
=
42 root_poa
->id_to_reference (id
.in ());
44 Interop::CDR_Out_Arg_var server
=
45 Interop::CDR_Out_Arg::_narrow (test_obj
.in ());
47 CORBA::String_var ior
=
48 orb
->object_to_string (server
.in ());
50 printf("Interop::CDR_Out_Arg: <%s>\n",
53 // If the ior_output_file exists, output the ior to it
54 if (ior_output_file
!= 0)
56 FILE *output_file
= fopen (ior_output_file
, "w");
57 if (output_file
== 0) {
58 printf("Cannot open output file for writing IOR: %s\n",
62 fprintf (output_file
, "%s", ior
.in ());
68 printf("event loop finished\n");
70 root_poa
->destroy (true, true);
74 catch (const CORBA::Exception
& ex
)
76 std::cerr
<< "Caught exception in server:" << ex
<< std::endl
;