本文整理汇总了C++中test::Hello_var::request_callback方法的典型用法代码示例。如果您正苦于以下问题:C++ Hello_var::request_callback方法的具体用法?C++ Hello_var::request_callback怎么用?C++ Hello_var::request_callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test::Hello_var
的用法示例。
在下文中一共展示了Hello_var::request_callback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: owner_transfer
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
if (CORBA::is_nil (root_poa.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Panic: nil RootPOA\n"),
1);
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
Hello *hello_impl;
ACE_NEW_RETURN (hello_impl,
Hello (orb.in ()),
1);
PortableServer::ServantBase_var owner_transfer(hello_impl);
PortableServer::ObjectId_var id =
root_poa->activate_object (hello_impl);
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
Test::Hello_var hello =
Test::Hello::_narrow (object.in ());
CORBA::String_var ior =
orb->object_to_string (hello.in ());
// Output the IOR to the <ior_output_file>
FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s",
ior_output_file),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
poa_manager->activate ();
CORBA::Object_var tmp =
orb->string_to_object(server_ior);
Test::Hello_var server =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior.in ()),
1);
}
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Sending client obj ref to the server and requesting a callback.\n"));
server->request_callback (hello.in ());
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Test (client) Succeeded !!!\n"));
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ACE_DEBUG ((LM_ERROR, "(%P|%t) - Test (client) Failed !!!\n"));
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}