本文整理汇总了C++中Test_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ Test_var::in方法的具体用法?C++ Test_var::in怎么用?C++ Test_var::in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test_var
的用法示例。
在下文中一共展示了Test_var::in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
PortableInterceptor::ORBInitializer_ptr temp_initializer =
PortableInterceptor::ORBInitializer::_nil ();
ACE_NEW_RETURN (temp_initializer,
Client_ORBInitializer,
-1); // No exceptions yet!
PortableInterceptor::ORBInitializer_var orb_initializer =
temp_initializer;
PortableInterceptor::register_orb_initializer (orb_initializer.in ());
CORBA::ORB_var orb = CORBA::ORB_init (argc,
argv,
"Client ORB");
if (::parse_args (argc, argv) != 0)
return -1;
CORBA::Object_var object =
orb->string_to_object (ior);
Test_var server =
Test::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
::client_test (server.in ());
::server_test (server.in ());
server->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return -1;
}
ACE_DEBUG ((LM_INFO,
"Request interceptor flow test passed.\n"));
return 0;
}
示例2: catch
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize and obtain reference to the Test object.
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);
Test_var server = Test::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: Object reference <%s> is nil\n",
ior),
-1);
}
// Make an invocation on the obtained Test object.
server->shutdown ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return -1;
}
return 0;
}
示例3: catch
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var obj = orb->resolve_initial_references("Test");
ACE_ASSERT (!CORBA::is_nil(obj.in()));
Test_var test = Test::_narrow( obj.in() );
ACE_ASSERT (!CORBA::is_nil(test.in()));
CORBA::Short n = test->get_server_num ();
ACE_DEBUG ((LM_DEBUG,
"Client received reply from server %d\n",
n));
if (expect_transient)
return -1;
return 0;
}
catch(const CORBA::TRANSIENT& ex) {
if (expect_transient)
return 0;
ex._tao_print_exception ("client:");
}
catch(const CORBA::Exception& ex) {
ex._tao_print_exception ("client:");
}
return -1;
}
示例4: policy_list
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var obj = orb->resolve_initial_references("Test");
if (CORBA::is_nil(obj.in()))
{
ACE_DEBUG ((LM_DEBUG, "Client could not RIR Test\n"));
return 1;
}
Test_var test = Test::_narrow( obj.in() );
if (CORBA::is_nil(test.in()))
{
ACE_DEBUG ((LM_DEBUG, "Client could not narrow Test\n"));
return 1;
}
test->_stubobj()->reset_profiles();
test->foo ();
CORBA::Any a;
a <<= Messaging::SYNC_WITH_SERVER;
CORBA::PolicyList policy_list (1);
policy_list.length (1);
policy_list[0] =
orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE, a);
obj = test->_set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE);
test = Test::_narrow ( obj.in());
test->_stubobj()->reset_profiles();
test->foo ();
CORBA::Short n = test->get_call_count();
ACE_DEBUG ((LM_DEBUG,
"Got call count of %d\n",
n));
return n != 1;
}
catch(const CORBA::Exception& ex) {
ex._tao_print_exception ("client:");
}
return -1;
}
示例5: 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;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t|%T) Client %d sending request to %C\n"),
client_num, server_ior));
try
{
CORBA::Object_var obj =
orb->string_to_object (server_ior);
ACE_ASSERT (!CORBA::is_nil (obj.in ()));
Test_var test = Test::_narrow (obj.in());
ACE_ASSERT (!CORBA::is_nil (test.in()));
CORBA::Short n = test->get_server_num ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t|%T) Client %d received reply from server %d\n"),
client_num, n));
}
catch (CORBA::TRANSIENT &)
{
if (expect_transient)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t|%T) Client %d got expected transient exception\n"),
client_num));
}
else
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t|%T) Client %d caught unexpected transent\n"),
client_num));
return -1;
}
}
return 0;
}
catch(const CORBA::Exception& ex)
{
ex._tao_print_exception (ACE_TEXT ("client:"));
}
return -1;
}
示例6: while
void
do_restart_test (void)
{
CORBA::Object_var obj = orb->string_to_object (ior);
ACE_ASSERT (!CORBA::is_nil(obj.in ()));
obj = set_timeout_policy (obj.in (), ACE_Time_Value (5,0));
Test_var test = Test::_narrow( obj.in () );
ACE_ASSERT (!CORBA::is_nil(test.in ()));
int attempt = 2;
while (attempt > 0)
{
try
{
test->arm ();
attempt = 0;
}
catch (const CORBA::Exception& ex)
{
attempt--;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client caught %C during arm, retrying\n"),
ex._name ()));
}
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client sleeping %d seconds\n"),
request_delay_secs));
ACE_OS::sleep (request_delay_secs);
try
{
test->trigger ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client trigger completed\n")));
return;
}
catch (const CORBA::Exception& ex)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client caught %C during first trigger\n"),
ex._name ()));
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client second trigger\n")));
test->trigger ();
}
示例7: catch
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int result = 0;
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_var server =
Test::_narrow(tmp.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil Test::Server reference <%s>\n",
ior),
1);
}
server->test_method();
result =0;
if (shutdown_server)
{
server->shutdown ();
}
orb->destroy ();
}
catch (const CORBA::Exception&)
{
result = 1;
}
return result;
}
示例8: catch
void
do_test (void)
{
CORBA::Object_var obj = orb->string_to_object (ior);
Test_var test = Test::_narrow( obj.in () );
ACE_ASSERT (!CORBA::is_nil(test.in ()));
try
{
test->contact ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client contact completed\n")));
return;
}
catch (const CORBA::Exception& ex)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("client caught %C during contact\n"),
ex._name ()));
}
}
示例9: test_i
char *
test_i::
create_and_activate_server()
{
PortableServer::Servant_var<test_i> impl(
new test_i (this->orb_.in ()));
CORBA::Object_var poa_object =
this->orb_->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
PortableServer::ObjectId_var id =
root_poa->activate_object (impl.in ());
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
Test_var ref = Test::_narrow (object.in ());
return this->orb_->object_to_string(ref.in());
}
示例10: catch
int
run_test (CORBA::ORB_ptr orb_ptr,
int target)
{
CORBA::ORB_var orb = CORBA::ORB::_duplicate (orb_ptr);
CORBA::Object_var object;
try
{
if (target == 1)
{
object =
orb->string_to_object (ior1);
}
else
{
object =
orb->string_to_object (ior2);
}
Test_var server =
Test::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference is nil\n"),
1);
server->method (0);
server->shutdown ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Client-side exception:");
}
return 0;
}
示例11: test_impl
void test_impl(
CORBA::ORB_ptr orb,
ACE_TCHAR const * ior,
bool shutdown)
{
CORBA::Object_var object = orb->string_to_object(ior);
Test_var test = Test::_narrow(object.in());
if(CORBA::is_nil(test.in()))
{
throw "Nil reference after narrow";
}
for(int i = 0; i != niterations; ++i)
{
test->sendc_the_operation(AMI_TestHandler::_nil());
}
ACE_Time_Value wait_for_responses_interval(1, 0);
orb->run(wait_for_responses_interval);
if (shutdown)
test->shutdown ();
}
示例12: get_opts
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
const ACE_TCHAR *iorfile = ACE_TEXT ("");
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("o:?"));
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
case 'o':
iorfile = get_opts.opt_arg ();
break;
case '?':
ACE_DEBUG ((LM_DEBUG,
"usage: %s "
"-d <seconds to delay before initializing POA> "
"-n Number of the server\n",
argv[0]));
return 1;
break;
}
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
root_poa = PortableServer::POA::_narrow (obj.in ());
// TAO_Root_POA::imr_client_adapter_name ("Test_Imr_Adapter");
ACE_CString base = ACE_CString ("TestObject");
createPOAs (base);
PortableServer::Servant_var<Test_i> test_servant = new Test_i ();
PortableServer::ObjectId_var object_id =
PortableServer::string_to_ObjectId (base.c_str());
poa_a->activate_object_with_id (object_id.in(), test_servant.in ());
obj = poa_a->id_to_reference (object_id.in());
Test_var tva = Test::_narrow (obj.in());
if (ACE_OS::strlen (iorfile) > 0)
{
CORBA::String_var ior = orb->object_to_string (obj.in());
FILE *output_file= ACE_OS::fopen (iorfile, "w");
if (output_file == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s\n",
iorfile),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
poa_b->activate_object_with_id (object_id.in(), test_servant.in ());
obj = poa_b->id_to_reference (object_id.in());
Test_var tvb = Test::_narrow (obj.in());
// object_id = root_poa->activate_object (test_servant.in());
//
// This server is now ready to run.
// This version does not create an IOR
// file as demonstrated in the
// Developer's Guide. It assumes that
// users create IORs for the client using
// the tao_imr utility.
//
//
// Stop discarding requests.
//
activatePOAs ();
//
// Create binding between "TestService" and
// the test object reference in the IOR Table.
// Use a TAO extension to get the non imrified poa
// to avoid forwarding requests back to the ImR.
TAO_Root_POA* tpoa = dynamic_cast<TAO_Root_POA*> (poa_a.in ());
ACE_ASSERT (tpoa != 0);
obj = tpoa->id_to_reference_i (object_id.in (), false);
CORBA::String_var test_ior = orb->object_to_string (obj.in ());
obj = orb->resolve_initial_references("IORTable");
IORTable::Table_var table = IORTable::Table::_narrow (obj.in ());
table->bind(base.c_str (), test_ior.in ());
{
ACE_CString status_file = base + ACE_CString(".status");
ofstream out(status_file.c_str ());
out << "started" << endl;
}
test_ior = orb->object_to_string (tva.in());
base += "_a";
//.........这里部分代码省略.........
示例13: svc
/// Thread entry point
int Client_Task::svc (void)
{
try
{
// Get a ref to the IORManipulation object
CORBA::Object_var IORM =
corb_->resolve_initial_references (TAO_OBJID_IORMANIPULATION,
0);
// Narrow
this->iorm_ =
TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in());
CORBA::Object_var iogr = make_iogr ("Domain_1", 1, 1);
CORBA::String_var iorgr_string =
corb_->object_to_string (iogr.in ());
CORBA::Object_var object =
corb_->string_to_object (iorgr_string.in ());
Test_var server =
Test::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil\n", iorgr_string.in()), 1);
}
CORBA::Object_var remote_server(
corb_->string_to_object (ACE_TString(file_prefix + this->server_ior_file_).c_str()));
Test_var remote_server_as_test =
Test::_narrow (remote_server.in ());
CORBA::Object_var collocated_server(
corb_->string_to_object (ACE_TString(file_prefix + this->collocated_ior_file_).c_str()));
Test_var collocated_server_as_test =
Test::_narrow (collocated_server.in ());
if (!collocated_server->_is_collocated())
{ // Collocation is disabled, just skip the test - it has no sense.
ACE_DEBUG ((LM_ERROR, "Test has no sense, because collocation is disabled.\n") );
}
else
{
try
{
// Following call will fail if the problem is not fixed.
// Because we are using TRANSIENT objects with the SYSTEM_ID policy
// the object keys won't match so the POA won't be able to dispatch locally.
// This wouldn't work with 'direct' collocation strategy but the default is 'through poa'.
server->myMethod ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught in client task:");
}
}
remote_server_as_test->shutdown();
collocated_server_as_test->shutdown();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught in client task:");
return 1;
}
return 0;
}
示例14: owner_transfer
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
// All factories are kindly provided by
// compiler so we just to put everything in a right order.
// Create and register factory for BaseNode.
BaseNode_init *bn_factory = 0;
ACE_NEW_RETURN (bn_factory,
BaseNode_init,
1);
orb->register_value_factory (bn_factory->tao_repository_id (),
bn_factory);
bn_factory->_remove_ref (); // release ownership
// Create and register factory for TreeController.
TreeController_init *tc_factory = 0;
ACE_NEW_RETURN (tc_factory,
TreeController_init,
1);
orb->register_value_factory (tc_factory->tao_repository_id (),
tc_factory);
tc_factory->_remove_ref (); // release ownership
// Create and register factory for StringNode.
StringNode_init *sn_factory = 0;
ACE_NEW_RETURN (sn_factory,
StringNode_init,
1);
orb->register_value_factory (sn_factory->tao_repository_id (),
sn_factory);
sn_factory->_remove_ref (); // release ownership
//Well, done with factories.
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;
Test_impl *test_impl;
ACE_NEW_RETURN (test_impl,
Test_impl (orb.in ()),
1);
PortableServer::ServantBase_var owner_transfer(test_impl);
PortableServer::ObjectId_var id =
root_poa->activate_object (test_impl);
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
Test_var test = Test::_narrow (object.in ());
CORBA::String_var ior =
orb->object_to_string (test.in ());
// If the ior_output_file exists, output the ior to it
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 ();
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:");
//.........这里部分代码省略.........
示例15: ACE_TMAIN
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);
// force a scope to see the destruction of the server object
{
Test_Smart_Factory *test_factory = 0;
ACE_NEW_RETURN (test_factory,
Test_Smart_Factory,
-1);
ACE_UNUSED_ARG (test_factory);
Test_var server =
Test::_narrow(obj.in());
if (CORBA::is_nil (server.in())) {
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
server->hello(3);
#if (TAO_HAS_MINIMUM_CORBA == 0)
// Testing the _non_existent function
ACE_DEBUG ((LM_DEBUG, "Testing _non_existent()\n"));
CORBA::Boolean ne =
server->_non_existent();
if (ne)
ACE_ERROR_RETURN ((LM_ERROR,
"Not a Messenger object reference\n"),
1);
else
ACE_DEBUG ((LM_DEBUG,"Successfully called _non_existent()\n"));
#endif /* TAO_HAS_MINIMUM_CORBA */
server->shutdown();
// The following sleep is a hack to make sure the above oneway
// request gets sent before we exit. Otherwise, at least on
// Windows XP, the server may not even get the request.
ACE_Time_Value tv (0, 100000);
ACE_OS::sleep(tv);
}
// here we should get the smart proxy destructor printout
if (!dtor_called) {
ACE_ERROR_RETURN((LM_ERROR,
"The Smart proxy is not deleted\n"),1);
}
orb->destroy();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Client-side exception:");
return 1;
}
return 0;
}