本文整理汇总了C++中corba::ORB_ptr::object_to_string方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_ptr::object_to_string方法的具体用法?C++ ORB_ptr::object_to_string怎么用?C++ ORB_ptr::object_to_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_ptr
的用法示例。
在下文中一共展示了ORB_ptr::object_to_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: factory_addr
int
FT_EventService::report_factory(CORBA::ORB_ptr orb,
FtRtecEventChannelAdmin::EventChannel_ptr ec)
{
try{
char* addr = ACE_OS::getenv("EventChannelFactoryAddr");
if (addr != 0) {
// instaniated by object factory, report my ior back to the factory
ACE_INET_Addr factory_addr(addr);
ACE_SOCK_Connector connector;
ACE_SOCK_Stream stream;
ORBSVCS_DEBUG((LM_DEBUG,"connecting to %s\n",addr));
if (connector.connect(stream, factory_addr) == -1)
ORBSVCS_ERROR_RETURN((LM_ERROR, "(%P|%t) Invalid Factory Address\n"), -1);
ORBSVCS_DEBUG((LM_DEBUG,"Factory connected\n"));
CORBA::String_var my_ior_string = orb->object_to_string(ec);
int len = ACE_OS::strlen(my_ior_string.in()) ;
if (stream.send_n(my_ior_string.in(), len) != len)
ORBSVCS_ERROR_RETURN((LM_ERROR, "(%P|%t) IOR Transmission Error\n"), -1);
stream.close();
}
}
catch (...){
return -1;
}
return 0;
}
示例2:
int
make_ior (CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
Hello * servant,
const ACE_TCHAR *ior_file)
{
CORBA::String_var poa_name = poa->the_name();
ACE_DEBUG ((LM_DEBUG, "Creating IOR from %C\n", poa_name.in()));
PortableServer::ObjectId_var oid = poa->activate_object (servant);
CORBA::Object_var o = poa->id_to_reference (oid.in ());
if (host_form == from_hostname || host_form == use_localhost)
{
CORBA::String_var ior =
orb->object_to_string (o.in ());
FILE *output_file= ACE_OS::fopen (ior_file, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file %s for writing IOR: %C",
ior_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
return 0;
}
示例3:
int
write_ior_to_file (CORBA::ORB_ptr orb,
test_ptr test)
{
CORBA::String_var ior =
orb->object_to_string (test);
char filename[BUFSIZ];
ACE_OS::sprintf (filename,
"%s_%d",
ACE_TEXT_ALWAYS_CHAR (ior_output_file),
ior_count++);
FILE *output_file =
ACE_OS::fopen (filename,
"w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s",
filename),
-1);
ACE_OS::fprintf (output_file,
"%s",
ior.in ());
ACE_OS::fclose (output_file);
return 0;
}
示例4: catch
int
TAO_Naming_Server::init (CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
size_t context_size,
ACE_Time_Value *timeout,
bool resolve_for_existing_naming_service,
const ACE_TCHAR *persistence_location,
void *base_addr,
int enable_multicast,
int use_storable_context,
int round_trip_timeout,
int use_round_trip_timeout)
{
if (resolve_for_existing_naming_service)
{
try
{
// Try to find an existing Naming Service.
CORBA::Object_var naming_obj =
orb->resolve_initial_references ("NameService", timeout);
if (!CORBA::is_nil (naming_obj.in ()))
{
//
// Success in finding a Naming Service.
//
if (TAO_debug_level > 0)
ORBSVCS_DEBUG ((LM_DEBUG,
"\nNameService found!\n"));
this->naming_context_ =
CosNaming::NamingContext::_narrow (naming_obj.in ());
this->naming_service_ior_ =
orb->object_to_string (naming_obj.in ());
return 0;
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("TAO_Naming_Server::init");
}
}
if (TAO_debug_level > 0)
ORBSVCS_DEBUG ((LM_DEBUG,
"\nWe'll become a NameService\n"));
// Become a Naming Service.
return this->init_new_naming (orb,
poa,
persistence_location,
base_addr,
context_size,
enable_multicast,
use_storable_context,
round_trip_timeout,
use_round_trip_timeout);
}
示例5:
int
create_object (PortableServer::POA_ptr poa,
CORBA::ORB_ptr orb,
Test_i *server_impl,
const ACE_TCHAR *filename)
{
// Register with poa.
PortableServer::ObjectId_var id =
poa->activate_object (server_impl);
CORBA::Object_var server =
poa->id_to_reference (id.in ());
// Print out the IOR.
CORBA::String_var ior =
orb->object_to_string (server.in ());
ACE_DEBUG ((LM_DEBUG, "<%C>\n\n", ior.in ()));
// Print ior to the file.
if (filename != 0)
{
FILE *output_file= ACE_OS::fopen (filename, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s",
filename),
-1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
return 0;
}
示例6:
int
write_ior_to_file (const ACE_TCHAR *ior_file,
CORBA::ORB_ptr orb,
CORBA::Object_ptr object)
{
CORBA::String_var ior =
orb->object_to_string (object);
FILE *output_file =
ACE_OS::fopen (ior_file,
"w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s",
ior_file),
-1);
ACE_OS::fprintf (output_file,
"%s",
ior.in ());
ACE_OS::fclose (output_file);
return 0;
}
示例7: out
int
run(CORBA::ORB_ptr orb, int argc, char* argv[])
{
//
// Resolve Root POA
//
CORBA::Object_var poaObj = orb -> resolve_initial_references("RootPOA");
PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObj);
//
// Get a reference to the POA manager
//
PortableServer::POAManager_var manager = rootPOA -> the_POAManager();
//
// Create implementation object
//
Testing_impl* testingImpl = new Testing_impl(rootPOA);
PortableServer::ServantBase_var servant = testingImpl;
Testing_var testing = testingImpl->_this();
//
// Save reference
//
CORBA::String_var s = orb->object_to_string(testing);
const char* refFile = "testing.ref";
ofstream out(refFile);
if(out.fail())
{
cerr << argv[0] << ": can't open `" << refFile << "': "
<< strerror(errno) << endl;
return EXIT_FAILURE;
}
out << s << endl;
out.close();
//
// Run implementation
//
manager->activate();
orb->run();
return EXIT_SUCCESS;
}
示例8: TestAppException
void
AppHelper::ref_to_file(CORBA::ORB_ptr orb,
CORBA::Object_ptr obj,
const ACE_TCHAR* filename)
{
CORBA::String_var ior = orb->object_to_string(obj);
FILE* ior_file = ACE_OS::fopen(filename, ACE_TEXT("w"));
if (ior_file == 0)
{
ACE_ERROR((LM_ERROR,
"(%P|%t) Cannot open output file [%s] to write IOR.\n",
filename));
throw TestAppException();
}
ACE_OS::fprintf(ior_file, "%s", ior.in());
ACE_OS::fclose(ior_file);
}
示例9:
static void
write_iors_to_file (CORBA::Object_ptr object,
CORBA::ORB_ptr orb,
const ACE_TCHAR *filename)
{
FILE *file =
ACE_OS::fopen (filename, "w");
ACE_ASSERT (file != 0);
CORBA::String_var ior =
orb->object_to_string (object);
u_int result = 0;
result =
ACE_OS::fprintf (file,
"%s",
ior.in ());
ACE_ASSERT (result == ACE_OS::strlen (ior.in ()));
ACE_UNUSED_ARG (result);
ACE_OS::fclose (file);
}
示例10:
static bool
marshaled_equal_to_other (CORBA::ORB_ptr orb, CORBA::Object_ptr obj, TAO_MProfile *other_mprofile)
{
CORBA::String_var str = orb->object_to_string (obj);
CORBA::Object_var obj_copy = orb->string_to_object (str.in ());
TAO_Stub *stub_copy = obj_copy->_stubobj ();
TAO_MProfile *copy_mprofile = &(stub_copy->base_profiles ());
if ( copy_mprofile->size() != other_mprofile->size())
return false;
for (size_t i=0; i<copy_mprofile->size(); ++i)
{
TAO_Profile *copy_profile = copy_mprofile->get_profile (i);
TAO_Profile *other_profile = other_mprofile->get_profile (i);
if ( ! equal_endpoint (copy_profile, other_profile) )
return false;
}
return true;
}
示例11: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Auto_Ptr< sig_i > sig_impl;
int status = 0;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CORBA::ORB_ptr orb = client.orb ();
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.in ());
// If the ior_output_file exists, output the ior to it
if (ior_output_file != 0)
{
FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
if (!CORBA::is_nil (admin.in ()))
{
create_suppliers(admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, " 1 supplier sending %d batches of %d events...\n", num_batches, PER_BATCH));
for (int i = 0; i < num_batches; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendEvents (i);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier waiting for consumer completion...\n"));
sig_impl->wait_for_completion();
ACE_DEBUG((LM_DEBUG, "\nSupplier finished.\n"));
ACE_OS::unlink (ior_output_file);
ec->destroy();
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: Supplier exception: ");
status = 1;
}
return status;
}
示例12: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Auto_Ptr< sig_i > sig_impl;
try
{
Supplier_Client client;
int status = client.init (argc, argv);
ACE_UNUSED_ARG(status);
ACE_ASSERT(status == 0);
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CosNotification::QoSProperties qos (1);
qos.length (1);
qos[0].name = CORBA::string_dup (CosNotification::OrderPolicy);
qos[0].value <<= order_policy;
ec->set_qos (qos);
CORBA::ORB_ptr orb = client.orb ();
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.in ());
if (ior_output_file != 0)
{
FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
ACE_ASSERT(!CORBA::is_nil (admin.in ()));
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, "1 supplier sending %d events...\n", num_events));
for (int i = 0; i < num_events / BATCH_SIZE; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendBatch (i);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier sent %d events.\n", num_events));
sig_impl->wait_for_completion();
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect();
ec->destroy();
return 0;
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
}
return 1;
}
示例13: catch
int
launch_plan (const Options &opts,
DAnCE::Plan_Launcher_Base *pl_base,
const ::Deployment::DeploymentPlan *plan,
CORBA::ORB_ptr orb)
{
DANCE_TRACE ("launch_plan");
try
{
CORBA::Object_var app_mgr, app;
CORBA::String_var
uuid_safe (pl_base->launch_plan (*plan, app_mgr.out () , app.out ()));
ACE_CString uuid = uuid_safe.in ();
DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT,
(LM_NOTICE, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Successfully deployed plan ")
ACE_TEXT ("with UUID: <%C>\n"),
uuid.c_str ()));
if (!opts.output_)
return 0;
ACE_TString am_output, app_output;
if (opts.output_prefix_)
am_output = app_output = opts.output_prefix_;
else
am_output = app_output = ACE_TEXT_CHAR_TO_TCHAR (uuid.c_str ());
am_output += ACE_TEXT ("_AM.ior");
app_output += ACE_TEXT ("_APP.ior");
DANCE_DEBUG (DANCE_LOG_MINOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Writing Application Manager IOR to <%s>\n"),
am_output.c_str ()));
CORBA::String_var tmp = orb->object_to_string (app_mgr.in ());
write_IOR (am_output.c_str (),
tmp.in ());
DANCE_DEBUG (DANCE_LOG_MINOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Writing Application IOR to <%s>\n"),
am_output.c_str ()));
tmp = orb->object_to_string (app.in ());
write_IOR (app_output.c_str (),
tmp.in ());
}
catch (const DAnCE::Deployment_Failure &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Deployment failed, exception: %C\n"),
ex.ex_.c_str ()));
}
return 1;
}
catch (const Deployment::PlanError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Caught PlanError exception: %C, %C\n"),
ex.name.in (),
ex.reason.in ()
));
}
return 1;
}
catch (const Deployment::StartError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Caught PlanError exception: %C, %C\n"),
ex.name.in (),
ex.reason.in ()
));
}
return 1;
}
catch (const Deployment::StopError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
//.........这里部分代码省略.........
示例14: if
//.........这里部分代码省略.........
return CORBA::Object::_nil ();
}
// Creating in process nameservice
CosNaming::NamingContext_var plan_nc;
if (this->options_.create_plan_ns_)
{
DANCE_DEBUG (DANCE_LOG_TRACE,
(LM_TRACE, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::init - ")
ACE_TEXT ("Resolving plan-specific naming context.\n")));
CORBA::Object_var naming_obj;
if (0 != this->options_.create_plan_ns_ior_)
{
naming_obj = orb->string_to_object (this->options_.create_plan_ns_ior_);
plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in());
if (CORBA::is_nil (plan_nc.in()))
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::init - ")
ACE_TEXT ("Failed trying to narrow naming context ")
ACE_TEXT ("for dance creating plan NC.\n")
ACE_TEXT ("Use the \"--create-plan-ns NC ior\" ")
ACE_TEXT ("or \"--process-ns\" option.\n")));
return CORBA::Object::_nil ();
}
}
else if (this->options_.process_ns_)
{
naming_obj = orb->resolve_initial_references ("NameService");
if (0 != this->options_.process_ns_file_)
{
CORBA::String_var ior = orb->object_to_string (naming_obj.in ());
DAnCE::Node_Manager::write_IOR (this->options_.process_ns_file_, ior.in ());
}
plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in ());
if (CORBA::is_nil (plan_nc.in ()))
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::init - ")
ACE_TEXT ("Fails trying to narrow naming context ")
ACE_TEXT ("for dance creating plan NC.\n")
ACE_TEXT ("Use the \"--create-plan-ns NC ior\" ")
ACE_TEXT ("or \"--process-ns\" option.\n")));
return CORBA::Object::_nil ();
}
}
else if (CORBA::is_nil (this->domain_nc_.in ()))
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO
ACE_TEXT ("DAnCE_NodeManager_Module::init - ")
ACE_TEXT ("The create plan is enabled but neither NC ior ")
ACE_TEXT ("nor --process-ns or DomainNC option are not supplied.\n")
ACE_TEXT ("Use the \"--create-plan-ns NC ior\", \"--process-ns\" ")
ACE_TEXT ("or \"-ORBInitRef DomainNC\" option.\n")));
return CORBA::Object::_nil ();
}
else
{
plan_nc = CosNaming::NamingContext::_duplicate (this->domain_nc_.in ());
}
}
示例15: servant
void
test_poas (CORBA::ORB_ptr orb,
PortableServer::POA_ptr root_poa,
PortableServer::POA_ptr first_poa,
PortableServer::POA_ptr second_poa,
PortableServer::POA_ptr third_poa,
PortableServer::POA_ptr forth_poa,
int perform_deactivation_test)
{
{
test_i servant (root_poa);
CORBA::Object_var obj = root_poa->create_reference ("IDL:test:1.0");
CORBA::String_var string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ObjectId_var id = root_poa->reference_to_id (obj.in ());
root_poa->activate_object_with_id (id.in (),
&servant);
obj = root_poa->id_to_reference (id.in ());
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ServantBase_var servant_from_reference =
root_poa->reference_to_servant (obj.in ());
PortableServer::ServantBase_var servant_from_id =
root_poa->id_to_servant (id.in ());
if (servant_from_reference.in () != servant_from_id.in ()
|| servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
"servant_from_id and &servant\n"));
}
obj = root_poa->servant_to_reference (&servant);
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
obj = servant._this ();
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ObjectId_var id_from_servant = root_poa->servant_to_id (&servant);
ACE_ASSERT (id_from_servant.in () == id.in ());
root_poa->deactivate_object (id.in ());
if (perform_deactivation_test)
{
root_poa->activate_object_with_id (id.in (),
&servant);
servant_from_reference = root_poa->reference_to_servant (obj.in ());
ACE_ASSERT (servant_from_reference.in () == &servant);
root_poa->deactivate_object (id.in ());
}
}
{
test_i servant (root_poa);
PortableServer::ObjectId_var id = root_poa->activate_object (&servant);
CORBA::Object_var obj = root_poa->id_to_reference (id.in ());
CORBA::String_var string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
obj = root_poa->create_reference_with_id (id.in (),
"IDL:test:1.0");
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
root_poa->deactivate_object (id.in ());
}
{
test_i servant (first_poa);
CORBA::Object_var obj = first_poa->create_reference ("IDL:test:1.0");
//.........这里部分代码省略.........