本文整理汇总了C++中corba::Object_var::_request方法的典型用法代码示例。如果您正苦于以下问题:C++ Object_var::_request方法的具体用法?C++ Object_var::_request怎么用?C++ Object_var::_request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::Object_var
的用法示例。
在下文中一共展示了Object_var::_request方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
do_primary_test (CORBA::Object_var &server,
Messaging::ReplyHandler_var &callback)
{
try
{
CORBA::Request_var req = server->_request("do_forward");
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior));
return;
}
ACE_DEBUG((LM_DEBUG,"Client sending test string\n"));
CORBA::String_var test_string = CORBA::string_dup ("123 look at me");
req->add_in_arg ("text") <<=
CORBA::Any::from_string(test_string.in(),30);
req->sendc(callback.in());
}
catch (CORBA::Exception &ex)
{
ACE_ERROR ((LM_ERROR,
"Client caught exception: %C\n",ex._name()));
}
}
示例2: history
void
test_octet_seq (const CORBA::Object_var object)
{
ACE_Sample_History history (niterations);
Test::octet_load ol (sz);
ol.length (sz);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
Test::Timestamp start_time = static_cast <Test::Timestamp> (start);
CORBA::Request_var request =
object->_request ("test_octet_method");
request->add_in_arg("octet_load") <<= ol;
request->add_in_arg("send_time") <<= start_time;
request->set_return_type (CORBA::_tc_ulonglong);
request->invoke ();
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
}
示例3: do_shutdown_test
int do_shutdown_test (CORBA::Object_var &server)
{
ACE_DEBUG ((LM_DEBUG,
"[client] invoking shutdown on the server \n"));
try
{
CORBA::Request_var req = server->_request("shutdown");
req->invoke();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Client: exception caught during shutdown - ");
return 1;
}
return 0;
}
示例4: history
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int priority =
(ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
+ ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
{
ACE_DEBUG ((LM_DEBUG,
"client (%P|%t): user is not superuser, "
"test runs in time-shared class\n"));
}
else
ACE_ERROR ((LM_ERROR,
"client (%P|%t): sched_params failed\n"));
}
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
if (CORBA::is_nil (object.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil CORBA::Object reference <%s>\n",
ior),
1);
}
for (int j = 0; j < 100; ++j)
{
CORBA::Request_var request =
object->_request ("test_method");
CORBA::ULongLong dummy = 0;
request->add_in_arg("send_time") <<= dummy;
request->set_return_type (CORBA::_tc_ulonglong);
request->invoke ();
}
ACE_Sample_History history (niterations);
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i < niterations; ++i)
{
ACE_hrtime_t start = ACE_OS::gethrtime ();
CORBA::Request_var request =
object->_request ("test_method");
CORBA::ULongLong start_time = static_cast <CORBA::ULongLong> (start);
request->add_in_arg("send_time") <<= start_time;
request->set_return_type (CORBA::_tc_ulonglong);
request->invoke ();
ACE_hrtime_t now = ACE_OS::gethrtime ();
history.sample (now - start);
}
ACE_hrtime_t test_end = ACE_OS::gethrtime ();
ACE_DEBUG ((LM_DEBUG, "test finished\n"));
ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration...."));
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "done\n"));
if (do_dump_history)
{
history.dump_samples (ACE_TEXT("HISTORY"), gsf);
}
ACE_Basic_Stats stats;
history.collect_basic_stats (stats);
stats.dump_results (ACE_TEXT("Total"), gsf);
ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), gsf,
test_end - test_start,
stats.samples_count ());
if (do_shutdown)
{
CORBA::Request_var request =
object->_request ("shutdown");
//.........这里部分代码省略.........
示例5: DII
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 obj = orb->string_to_object(ior);
const char* the_string = 0;
ACE_DEBUG ((LM_INFO, "(%P|%t) - #### Synchronous twoway DII\n"));
CORBA::Request_var req = obj->_request ("get_string");
req->set_return_type (CORBA::_tc_string);
req->invoke ();
req->return_value () >>= the_string;
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string));
ACE_DEBUG ((LM_INFO, "(%P|%t) - #### Deferred twoway DII (using get_response())\n"));
req = obj->_request ("get_string");
req->set_return_type (CORBA::_tc_string);
req->send_deferred ();
ACE_DEBUG ((LM_INFO, "(%P|%t) - Get response...\n"));
req->get_response ();
req->return_value () >>= the_string;
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string));
ACE_DEBUG ((LM_INFO, "(%P|%t) - #### Deferred twoway DII (using poll_response())\n"));
req = obj->_request ("get_string");
req->set_return_type (CORBA::_tc_string);
req->send_deferred ();
do {
ACE_OS::sleep(1);
ACE_DEBUG ((LM_INFO, "(%P|%t) - Polling...\n"));
} while (!req->poll_response ());
req->return_value () >>= the_string;
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
the_string));
ACE_DEBUG ((LM_INFO, "(%P|%t) - #### Oneway shutdown DII\n"));
req = obj->_request ("shutdown");
req->send_oneway ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例6: if
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int priority =
(ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
+ ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
{
ACE_DEBUG ((LM_DEBUG,
"client (%P|%t): user is not superuser, "
"test runs in time-shared class\n"));
}
else
ACE_ERROR ((LM_ERROR,
"client (%P|%t): sched_params failed\n"));
}
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
if (CORBA::is_nil (object.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil CORBA::Object reference <%s>\n",
ior),
1);
}
Test::octet_load oc;
for (int j = 0; j < 100; ++j)
{
CORBA::Request_var request =
object->_request ("test_octet_method");
Test::Timestamp dummy = 0;
request->add_in_arg("octet_load") <<= oc;
request->add_in_arg("send_time") <<= dummy;
request->set_return_type (CORBA::_tc_ulonglong);
request->invoke ();
}
// Test various sequence types
if (ACE_OS::strcmp (data_type, ACE_TEXT("octet")) == 0 )
{
test_octet_seq (object);
}
else if (ACE_OS::strcmp (data_type, ACE_TEXT("char")) == 0)
{
test_char_seq (object);
}
else if (ACE_OS::strcmp (data_type, ACE_TEXT("long")) == 0)
{
test_long_seq (object);
}
else if (ACE_OS::strcmp (data_type, ACE_TEXT("short")) == 0)
{
test_short_seq (object);
}
else if (ACE_OS::strcmp (data_type, ACE_TEXT("double")) == 0)
{
test_double_seq (object);
}
else if (ACE_OS::strcmp (data_type, ACE_TEXT("longlong")) == 0)
{
test_longlong_seq (object);
}
if (do_shutdown)
{
CORBA::Request_var request =
object->_request ("shutdown");
request->invoke ();
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}