本文整理汇总了C++中test::Hello_var::get_string方法的典型用法代码示例。如果您正苦于以下问题:C++ Hello_var::get_string方法的具体用法?C++ Hello_var::get_string怎么用?C++ Hello_var::get_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test::Hello_var
的用法示例。
在下文中一共展示了Hello_var::get_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
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 tmp =
orb->string_to_object(ior);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
CORBA::String_var the_string =
hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
if (expect_error)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - expected exception occurred!\n%s\n",
ex._info().c_str()));
return 0;
}
else
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
}
if (expect_error)
{
ACE_DEBUG ((LM_ERROR, "(%P|%t) client - expected error did not occur!\n"));
return 1;
}
return 0;
}
示例2: catch
int
Client_Task::svc (void)
{
try
{
CORBA::Object_var tmp =
this->corb_->string_to_object (input_);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
input_),
1);
}
CORBA::String_var the_string =
hello->get_string ();
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) - string returned <%C>\n",
the_string.in ()));
if (!this->result_)
{
// We would expect the call to fail, so we have an error now
ACE_ERROR ((LM_ERROR, "(%P|%t) - ERROR: get_string should have failed\n"));
}
hello->shutdown ();
}
catch (const CORBA::TRANSIENT& ex)
{
if (!this->result_)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - caught expected exception\n"));
// When collocation has been disabled we expect a transient
// with minor code 2
return 0;
}
ex._tao_print_exception ("Caught exception:");
return 1;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例3: catch
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 tmp = orb->string_to_object(ior);
Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
if (oneway_call)
{
CORBA::String_var the_string = CORBA::string_dup( "Test" );
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Client sending string <%C> oneway\n",
the_string.in ()));
hello->set_string (the_string);
}
else
{
CORBA::String_var the_string = hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Client getting string <%C>\n",
the_string.in ()));
}
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例4: catch
int
Client_Task::svc (void)
{
CORBA::Boolean exception = false;
try
{
CORBA::Object_var tmp =
this->corb_->string_to_object (input_);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
input_),
1);
}
try
{
CORBA::String_var the_string =
hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
hello->shutdown ();
}
catch (CORBA::INTERNAL)
{
exception = true;
ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n"));
corb_->destroy ();
return 0;
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
if (!exception)
{
ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n"));
}
return 0;
}
示例5: catch
int
Client_Task::svc (void)
{
int status = 1;
try
{
CORBA::Object_var tmp =
this->corb_->string_to_object (input_);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
input_),
1);
}
CORBA::String_var the_string =
hello->get_string ();
if (ACE_OS::strcmp (the_string.in (), "Hello there!") != 0)
{
ACE_ERROR ((LM_ERROR, "(%P|%t) - Error, incorrect string returned <%C>\n",
the_string.in ()));
status = 1;
}
else
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
}
hello->shutdown ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
status = 1;
}
return status;
}
示例6: catch
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 tmp =
orb->string_to_object(ior);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
CORBA::String_var A = CORBA::string_dup ("DKWC");
CORBA::String_var B = CORBA::string_dup ("kwc");
CORBA::String_var C = CORBA::string_dup ("MV-files");
CORBA::String_var the_string =
hello->get_string (A.in (), B.in (), C.in ());
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例7: handle_timeout
virtual int handle_timeout(const ACE_Time_Value &, const void *)
{
--iterationsLeft;
try
{
ACE_DEBUG ((LM_DEBUG,
"\n(%P|%t) - handling timeout with %d iterations left\n",
iterationsLeft + 1));
CORBA::Object_var tmp = orb->string_to_object(ior);
Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
CORBA::String_var the_string = hello->get_string ();
++successfulConnections;
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
ACE_OS::sleep(2);
hello->shutdown ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - shutdown requested\n"));
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
process_result = 1;
orb->shutdown();
}
if(successfulConnections == 2)
{
process_result = 0;
orb->shutdown();
}
return 0;
}
示例8: my_seq
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 tmp = orb->string_to_object(ior);
Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
CORBA::StringSeq my_seq (1);
my_seq.length (1);
hello->get_string (my_seq[0].out ());
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
my_seq[0].in ()));
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例9: catch
int
Client_Task::svc (void)
{
try
{
CORBA::Object_var tmp = this->corb_->string_to_object (input_);
Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
input_),
1);
}
CORBA::String_var the_string = hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
this->test_system_exception (hello.in ());
this->test_user_exception_expected (hello.in ());
this->test_user_exception_not_expected (hello.in ());
hello->shutdown ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例10: tmp
int
Client_Worker::test_main (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Could not parse the arguments\n")),
1);
// Doing this dance to allow the server some time to come up.
CORBA::Object_ptr co = 0;
for (int attempts_left = 5; attempts_left > 0; --attempts_left)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client is ready to proceed - awaiting the server ...\n")));
ACE_OS::sleep (1);
try
{
co = orb->string_to_object (ior_file_.c_str ());
if (co == 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Unable to obtain object reference yet. Retrying.\n")));
continue;
}
CORBA::Object_var tmp (co);
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Nil Test::Hello reference <%s>. Retrying.\n"),
ior_file_.c_str ()));
continue;
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Successfuly narrowed the Hello interface\n")));
CORBA::String_var the_string =
hello->get_string ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) String returned from the server <%C>\n"),
the_string.in ()));
hello->shutdown ();
attempts_left = 0; // We're done here!
}
catch (const CORBA::TRANSIENT& ex)
{
if (!attempts_left)
throw;
ex._tao_print_exception ("Temporary problem encountered");
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Client was too quick. Pausing ")
ACE_TEXT ("while the server gets ready.\n")));
ACE_OS::sleep (5);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception("Unexpected CORBA exception caught");
if (!attempts_left)
throw;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Pausing for a while.\n")));
ACE_OS::sleep (5);
}
}
orb->shutdown (0);
orb->destroy ();
}
catch (const ::CORBA::Exception &e)
{
e._tao_print_exception("Client_Worker::test_main");
return 1;
}
return 0;
}
示例11: beginning
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 tmp = orb->string_to_object (ior);
// No remote calls, first request flag is on.
if (!first_request_flag (tmp.in ()))
{
ACE_ERROR ((LM_ERROR,
"Test FAILED at the beginning (why?)\n"));
}
// This call must issue LocateRequest message.
CORBA::PolicyList_var pl;
tmp->_validate_connection (pl.out ());
// There was a LocateRequest call, first request flag
// must be still on.
if (!first_request_flag (tmp.in ()))
{
ACE_ERROR ((LM_ERROR,
"Test FAILED after LocateRequest (bug#3676 is not fixed)!!\n"));
}
Test::Hello_var hello = Test::Hello::_narrow (tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
CORBA::String_var the_string = hello->get_string ();
// Either _narrow or get_string issued a remote call,
// first request flag is off.
if (first_request_flag (tmp.in ()))
{
ACE_ERROR ((LM_ERROR,
"Test FAILED after normal request (why?)\n"));
}
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例12: policies
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;
// Get the RTORB.
CORBA::Object_var obj = orb->resolve_initial_references ("RTORB");
RTCORBA::RTORB_var rtorb = RTCORBA::RTORB::_narrow (obj.in());
//create the private connections policy. This means that every connection
// to the server uses his own socket.
CORBA::PolicyList policies (1);
policies.length (1);
policies[0] = rtorb->create_private_connection_policy ();
CORBA::Object_var pol_current_object = orb->resolve_initial_references ("PolicyCurrent");
CORBA::PolicyCurrent_var policy_current =
CORBA::PolicyCurrent::_narrow (pol_current_object.in ());
if (CORBA::is_nil (policy_current.in ()))
{
ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n"));
return 1;
}
policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);
Test::Hello_var *hello_array = 0;
ACE_NEW_RETURN (hello_array, Test::Hello_var [cache_size], -1);
int iter = 1;
for (iter = 1; iter <= cache_size; ++iter)
{
char object_string[256];
char reference_string[256];
ACE_OS::sprintf (reference_string, "TransportCacheTest%d", iter);
ACE_OS::sprintf (object_string, "corbaloc:iiop:localhost:%d/", port_nr);
ACE_OS::strcat (object_string, reference_string);
CORBA::Object_var hello_obj = orb->string_to_object (object_string);
orb->register_initial_reference (reference_string, hello_obj.in ());
CORBA::String_var ior_string = orb->object_to_string (hello_obj.in());
ACE_DEBUG((LM_DEBUG, ACE_TEXT("IOR string for reference %d : %C\n"),
iter, ior_string.in ()));
hello_array[iter-1] = Test::Hello::_narrow(hello_obj.in ());
}
//now we've got the references -> call each and everyone of them
for (iter = 0; iter < cache_size; ++iter)
{
Test::Hello_var hello = hello_array[iter];
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("Nil Test::Hello reference\n")),
1);
}
CORBA::String_var the_string = hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C> from reference %d\n",
the_string.in (), iter + 1));
}
//shutdown the server
if (iter >= 0)
hello_array[0]->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例13: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
ACE_Get_Opt opts (argc, argv, ACE_TEXT ("s:c:"));
const ACE_TCHAR *server = 0, *client = 0;
for (int o; (o = opts ()) != -1;)
{
switch (o)
{
case 's':
server = opts.opt_arg ();
break;
case 'c':
client = opts.opt_arg ();
break;
}
}
Servant srv (orb);
ORBTask task (orb);
if (server)
{
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow (obj);
PortableServer::POAManager_var pm = poa->the_POAManager ();
pm->activate ();
Test::Hello_var srv_obj = srv._this ();
CORBA::String_var srv_str = orb->object_to_string (srv_obj);
FILE *f = ACE_OS::fopen (server, "w");
ACE_OS::fputs (srv_str, f);
ACE_OS::fclose (f);
if (!client)
task.activate();
}
if (client)
{
ACE_CString ior ("file://");
ior += ACE_TEXT_ALWAYS_CHAR (client);
CORBA::Object_var obj = orb->string_to_object (ior.c_str ());
Test::Hello_var hello = Test::Hello::_narrow (obj);
CORBA::String_var str = hello->get_string ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) - returned <%C>\n"),
str.in ()));
hello->shutdown ();
}
else if (server)
{
task.wait ();
}
orb->destroy ();
return 0;
}
catch (const CORBA::Exception &e)
{
e._tao_print_exception ("Exception caught:");
}
catch (...)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR unknown exception ")
ACE_TEXT ("caught in main\n")));
}
return 1;
}
示例14: if
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, "test");
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var tmp = orb->string_to_object(ior);
if (CORBA::is_nil (tmp.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR, "Invalid IOR.\n")
,1);
}
{
// Set the Synch Scopes
CORBA::Any scope_as_any;
if (synch_none == true)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Applying SYNC_NONE.\n"));
scope_as_any <<= Messaging::SYNC_NONE;
}
else if (synch_delayed == true)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) - Applying SYNC_DELAYED_BUFFERING.\n"));
scope_as_any <<= TAO::SYNC_DELAYED_BUFFERING;
}
CORBA::PolicyList policies (1);
policies.length (1);
policies[0] =
orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE,
scope_as_any);
if (level_thread == true)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) - Applying Synch Scope at thread level.\n"));
CORBA::Object_var object =
orb->resolve_initial_references ("PolicyCurrent");
CORBA::PolicyCurrent_var policy_current =
CORBA::PolicyCurrent::_narrow (object.in ());
policy_current->set_policy_overrides (policies,
CORBA::ADD_OVERRIDE);
}
else if (level_orb == true)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) - Applying Synch Scope at orb level.\n"));
CORBA::Object_var obj =
orb->resolve_initial_references("ORBPolicyManager");
CORBA::PolicyManager_var policy_manager =
CORBA::PolicyManager::_narrow(obj.in());
policy_manager->set_policy_overrides (policies,
CORBA::ADD_OVERRIDE);
}
else if (level_obj == true)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) - Applying Synch Scope at Object level.\n"));
tmp = tmp->_set_policy_overrides (policies, CORBA::SET_OVERRIDE);
}
policies[0]->destroy ();
}
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil Test::Hello reference <%s>\n",
ior),
1);
}
// If a blocking connection is initiated in the next step
// the test will get an exception indicating test failure.
// Be sure you IOR is for the localhost endpoint, else
// grab a book and wait around for timeout.
hello->get_string ();
TAO::Transport_Cache_Manager &tcm =
hello->orb_core ()->lane_resources ().transport_cache ();
TAO_Base_Transport_Property desc (hello->_stubobj ()->profile_in_use ()->endpoint ());
//.........这里部分代码省略.........
示例15: catch
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 tmp =
orb->string_to_object("corbaloc:iiop:[email protected]:9931/NameService");
CosNaming::NamingContext_var root =
CosNaming::NamingContext::_narrow(tmp.in());
if (CORBA::is_nil (root.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil NamingService reference\n"),
1);
}
ACE_DEBUG ((LM_INFO, "**** Narrowed root NamingContext\n"));
CosNaming::Name name;
name.length(2);
name[0].id = CORBA::string_dup("example");
name[1].id = CORBA::string_dup("Hello");
try
{
tmp = root->resolve (name);
ACE_DEBUG ((LM_INFO, "**** Resolved #example/Hello\n"));
Test::Hello_var hello =
Test::Hello::_narrow(tmp.in ());
if (CORBA::is_nil (hello.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Hello reference\n"),
1);
}
CORBA::String_var the_string = hello->get_string ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string.in ()));
hello->shutdown ();
}
catch (const CosNaming::NamingContext::CannotProceed&)
{
ACE_DEBUG ((LM_DEBUG, "Caught correct exception\n"));
}
if (shutdown_nsmain)
{
CORBA::Object_var shutdowntmp = orb->string_to_object(ior);
Test::NsShutdown_var shutdown =
Test::NsShutdown::_narrow(shutdowntmp.in ());
ACE_DEBUG ((LM_DEBUG, "Shutdown nsmain\n"));
shutdown->shutdown ();
}
orb->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}