本文整理汇总了C++中iortable::Table_var::rebind方法的典型用法代码示例。如果您正苦于以下问题:C++ Table_var::rebind方法的具体用法?C++ Table_var::rebind怎么用?C++ Table_var::rebind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iortable::Table_var
的用法示例。
在下文中一共展示了Table_var::rebind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: owner_transfer
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
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 ();
if (parse_args (argc, argv) != 0)
return 1;
Hello *hello_impl = 0;
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 ());
CORBA::Object_var tmp = orb->resolve_initial_references("IORTable");
IORTable::Table_var iorTable = IORTable::Table::_narrow(tmp.in ());
if (CORBA::is_nil(iorTable.in ()))
{
ACE_ERROR ((LM_ERROR, "could not get the IORTable, will not register\n"));
}
else
{
iorTable->rebind("Hello", ior.in());
}
// try and access the object with its friendly name
ACE_CString full_corbaloc (ior.in (), 0, 1);
CORBA::ULong first_slash = full_corbaloc.find ("/", 0);
ACE_CString friendly_corbaloc =
full_corbaloc.substring (0,
first_slash);
friendly_corbaloc += "/Hello";
// 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\n",
ior_output_file),
1);
ACE_OS::fprintf (output_file, "%s", friendly_corbaloc.c_str ());
ACE_OS::fclose (output_file);
poa_manager->activate ();
orb->run ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
root_poa->destroy (1, 1);
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}