本文整理汇总了C++中Simple_Server_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ Simple_Server_var::in方法的具体用法?C++ Simple_Server_var::in怎么用?C++ Simple_Server_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simple_Server_var
的用法示例。
在下文中一共展示了Simple_Server_var::in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: policies
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");
if (CORBA::is_nil (poa_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize the POA.\n"),
1);
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager ();
// Policies for the childPOA to be created.
CORBA::PolicyList policies (1);
policies.length (1);
CORBA::Any pol;
pol <<= BiDirPolicy::BOTH;
policies[0] =
orb->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, pol);
// Create POA as child of RootPOA with the above policies. This POA
// will receive request in the same connection in which it sent
// the request
PortableServer::POA_var child_poa =
root_poa->create_POA ("childPOA", poa_manager.in (), policies);
// Creation of childPOA is over. Destroy the Policy objects.
for (CORBA::ULong i = 0; i < policies.length (); ++i)
{
policies[i]->destroy ();
}
poa_manager->activate ();
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object = orb->string_to_object (ior);
Simple_Server_var server = Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%C> is nil\n",
ior),
1);
}
Callback_i callback_impl (orb.in ());
PortableServer::ObjectId_var id =
PortableServer::string_to_ObjectId ("client_callback");
child_poa->activate_object_with_id (id.in (), &callback_impl);
CORBA::Object_var callback_object =
child_poa->id_to_reference (id.in ());
Callback_var callback = Callback::_narrow (callback_object.in ());
CORBA::String_var ior = orb->object_to_string (callback.in ());
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client callback activated as <%C>\n",
ior.in ()));
// Send the calback object to the server
server->callback_object (callback.in ());
int pre_call_connections =
orb->orb_core ()->lane_resources ().transport_cache ().current_size ();
// A method to kickstart callbacks from the server
CORBA::Long r = server->test_method (1);
if (r != 0)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) unexpected result = %d ",
r));
}
orb->run ();
int cur_connections =
orb->orb_core ()->lane_resources ().transport_cache ().current_size ();
if (cur_connections > pre_call_connections)
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) Expected %d "
//.........这里部分代码省略.........
示例2: client
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the ORB
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
// Get Object Reference using IOR file
CORBA::Object_var object =
orb->string_to_object (ior);
// Cast to Appropriate Type
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil\n", ior),
1);
}
Client_Worker client (server.in (), niterations);
if (client.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Cannot Activate Client Threads\n"),
1);
client.thr_mgr ()->wait ();
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) threads finished\n"));
// Shut down the server if -x option given in command line
if (do_shutdown)
{
server->shutdown ();
}
// Destroying the ORB..
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例3: iors
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;
// Primary server
CORBA::Object_var object_primary =
orb->string_to_object (ior);
//Secondary server
CORBA::Object_var object_secondary =
orb->string_to_object (name);
// Get an object reference for the ORBs IORManipultion object!
CORBA::Object_ptr IORM =
orb->resolve_initial_references (TAO_OBJID_IORMANIPULATION,
0);
TAO_IOP::TAO_IOR_Manipulation_ptr iorm =
TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM);
TAO_IOP::TAO_IOR_Manipulation::IORList iors (2);
iors.length(2);
iors [0] = object_primary;
iors [1] = object_secondary;
CORBA::Object_var merged = iorm->merge_iors (iors);
// Combined IOR stuff
Simple_Server_var server =
Simple_Server::_narrow (merged.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
run_test (server.in ());
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught an exception\n");
return -1;
}
return 0;
}
示例4: client
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 object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
Client client (server.in (), niterations);
if (client.activate (THR_NEW_LWP | THR_JOINABLE,
nthreads) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot activate client threads\n"),
1);
client.thr_mgr ()->wait ();
ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
if (server_shutdown)
{
server->shutdown ();
}
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return 1;
}
return 0;
}
示例5: ACE_TMAIN
//int testClient (char* orbName, char* ior)
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc,
argv,
"ORB_Test_Client");
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
CORBA::String_var string =
orb->object_to_string (server.in ());
ACE_DEBUG ((LM_DEBUG,
"Client: orb->object_to_string: <%C>\n",
string.in ()));
Client client (server.in (), niter);
client.svc ();
//ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return 1;
}
return 0;
}
示例6:
void
Worker::run_test (void)
{
CORBA::Object_var object =
this->orb_->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior));
return;
}
CORBA::Boolean r =
server->test_is_a ("IDL:Foo:1.0");
if (r != 0)
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) unexpected result = %d\n",
r));
}
示例7: ior_buffer
void
Client_i::init (void)
{
// Open the file for reading.
ACE_HANDLE f_handle = ACE_OS::open (ior_output_file,
0);
if (f_handle == ACE_INVALID_HANDLE)
ACE_ERROR ((LM_ERROR,
"Unable to open %s for writing: %p\n",
ior_output_file));
ACE_Read_Buffer ior_buffer (f_handle);
char *data = ior_buffer.read ();
if (data == 0)
ACE_ERROR ((LM_ERROR,
"Unable to read ior: %p\n"));
int argc = 0;
ACE_TCHAR **argv = 0;
this->orb_ = CORBA::ORB_init (argc, argv);
CORBA::Object_var object =
this->orb_->string_to_object (data);
// Combined IOR stuff
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR ((LM_ERROR,
"Object reference <%C> is nil\n",
data));
}
run_test (server.in ());
ior_buffer.alloc ()->free (data);
ACE_OS::close (f_handle);
}
示例8: catch
int
SelfClient::svc (void)
{
try
{
this->validate_connection ();
for (int i = 0; i < this->niterations_; ++i)
{
try
{
CORBA::Object_var probably_not_exist =
orb_->string_to_object (corbaloc_arg);
if (CORBA::is_nil (probably_not_exist.in()))
{
ACE_DEBUG ((LM_DEBUG, "not found\n", corbaloc_arg));
}
else
{
Simple_Server_var newserver =
Simple_Server::_narrow (probably_not_exist.in ());
// should throw an exception
if (CORBA::is_nil (newserver.in()))
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Not found it\n"));
}
else
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Found it\n"));
}
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("MT_SelfClient: exception raised");
}
// Just make a call
this->server_->test_method (i);
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("MT_SelfClient: exception raised");
}
return 0;
}
示例9: wrk
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 object = orb->string_to_object (ior);
Simple_Server_var server = Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior), 1);
}
if (do_shutdown)
{
server->shutdown ();
}
else
{
Worker wrk (server.in ());
wrk.activate (THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, nthreads);
wrk.thr_mgr ()->wait ();
}
}
catch (const CORBA::Exception& ex)
{
ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) ERROR: Exception caught: \n%C\n"),
ex._info ().c_str ()));
return 1;
}
return 0;
}
示例10: 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 object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
CORBA::Boolean non_existent = server->_non_existent ();
if (non_existent)
result = 3;
else
result = 2;
ACE_DEBUG ((LM_DEBUG,
"client (%P) _non_existent() returned %d\n",
static_cast<int>(non_existent) ));
orb->destroy ();
}
catch (const CORBA::OBJECT_NOT_EXIST& ex)
{
ex._tao_print_exception ("ERROR: Exception caught:");
result = 4;
}
catch (const CORBA::TRANSIENT&)
{
result = 5;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("ERROR: Exception caught:");
result = 6;
}
return result;
}
示例11: 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 object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
for (int i = 0; i != niterations; ++i)
{
CORBA::Long r =
server->test_method (i);
if (r != i)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) unexpected result = %d for %d",
r, i));
}
}
if (do_shutdown)
{
server->shutdown ();
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例12: buf
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 object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil\n",
ior),
1);
}
while (!feof (stdin))
{
ACE_Read_Buffer buf (stdin, 0);
char *line = buf.read ('\n');
if (line == 0)
break;
server->send_line (line);
buf.alloc ()->free (line);
}
server->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return 1;
}
return 0;
}
示例13: catch
int
Client::svc (void)
{
try
{
for (int i = 0; i < this->niterations_; ++i)
{
// If we are using a global ORB this is a nop, otherwise it
// initializes the ORB resources for this thread.
int argc = 0;
CORBA::String_var argv0 = CORBA::string_dup ("dummy_argv");
char* argv[1] = { argv0.inout () };
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
CORBA::Object_var object =
orb->string_to_object (this->ior_);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) Object reference <%s> is nil\n",
ior),
1);
}
server->test_method ();
if (TAO_debug_level > 0 && i % 100 == 0)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("MT_Client: exception raised");
}
return 0;
}
示例14: server_impl
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");
if (CORBA::is_nil (poa_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize the POA.\n"),
1);
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager ();
if (parse_args (argc, argv) != 0)
return 1;
Simple_Server_i server_impl (orb.in ());
PortableServer::ObjectId_var id =
root_poa->activate_object (&server_impl);
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
Simple_Server_var server = Simple_Server::_narrow (object.in ());
CORBA::String_var local_ior = orb->object_to_string (server.in ());
ACE_DEBUG ((LM_DEBUG,
"Client interface started on <%C>\n",
local_ior.in ()));
CORBA::Object_var remote_object = orb->string_to_object (ior);
Simple_Server_var remote_server =
Simple_Server::_narrow (remote_object.in ());
if (CORBA::is_nil (remote_server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil\n",
ior), 1);
}
if (do_shutdown)
{
remote_server->shutdown ();
}
else
{
poa_manager->activate ();
Worker worker (orb.in ());
if (worker.activate (THR_NEW_LWP | THR_JOINABLE,
1) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot activate client thread\n"),
1);
ACE_DEBUG ((LM_DEBUG, "ORB Thread started\n"));
CORBA::String_var str = remote_server->test_method (server.in ());
ACE_DEBUG ((LM_DEBUG, "Received \"%C\"\n", str.in ()));
orb->shutdown (true);
worker.thr_mgr ()->wait ();
ACE_DEBUG ((LM_DEBUG, "ORB Thread completed\n"));
}
orb->destroy ();
}
catch (CORBA::Exception& ex)
{
ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) Exception caught: \n%s\n"),
ACE_TEXT_CHAR_TO_TCHAR (ex._info ().c_str ())));
return 1;
}
return 0;
}
示例15: server_impl
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");
if (CORBA::is_nil (poa_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize the POA.\n"),
1);
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
// Get the POAManager of the RootPOA.
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
if (parse_args (argc, argv) != 0)
return 1;
Simple_Server_i server_impl (orb.in ());
PortableServer::ObjectId_var id =
root_poa->activate_object (&server_impl);
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
CORBA::String_var ior =
orb->object_to_string (server.in ());
ACE_DEBUG ((LM_DEBUG, "Activated as <%C>\n", ior.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 for writing IOR: %s",
ior_output_file),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
// RUn the event loop if needed
if (orb_run)
{
orb->run ();
}
ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
root_poa->destroy (1, 1);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return 1;
}
return 0;
}