本文整理汇总了C++中corba::ORB_var::orb_core方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::orb_core方法的具体用法?C++ ORB_var::orb_core怎么用?C++ ORB_var::orb_core使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_var
的用法示例。
在下文中一共展示了ORB_var::orb_core方法的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: task
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
int result =
parse_args (argc, argv);
if (result != 0)
return result;
// Thread Manager for managing task.
ACE_Thread_Manager thread_manager;
// Create task.
Task task (thread_manager,
orb.in ());
// Task activation flags.
long flags =
THR_NEW_LWP |
THR_JOINABLE |
orb->orb_core ()->orb_params ()->thread_creation_flags ();
// Activate task.
result =
task.activate (flags);
if (result == -1)
{
if (errno == EPERM)
{
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot create thread with scheduling policy %s\n"
"because the user does not have the appropriate privileges, terminating program....\n"
"Check svc.conf options and/or run as root\n",
sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())),
2);
}
else
// Unexpected error.
ACE_ASSERT (0);
}
// Wait for task to exit.
result =
thread_manager.wait ();
ACE_ASSERT (result != -1);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught");
return -1;
}
return 0;
}
示例3: periodicTask
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;
PeriodicTask periodicTask(orb);
orb->orb_core()->reactor()->schedule_timer(&periodicTask, 0, ACE_Time_Value::zero, ACE_Time_Value(timeout));
orb->run();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return process_result;
}
示例4: if
void
TAO_Notify_ThreadPool_Task::init (const NotifyExt::ThreadPoolParams& tp_params,
const TAO_Notify_AdminProperties::Ptr& admin_properties)
{
ACE_ASSERT (this->timer_.get() == 0);
TAO_Notify_Timer_Queue* timer = 0;
ACE_NEW_THROW_EX (timer,
TAO_Notify_Timer_Queue (),
CORBA::NO_MEMORY ());
this->timer_.reset (timer);
TAO_Notify_Buffering_Strategy* buffering_strategy = 0;
ACE_NEW_THROW_EX (buffering_strategy,
TAO_Notify_Buffering_Strategy (*msg_queue (), admin_properties),
CORBA::NO_MEMORY ());
this->buffering_strategy_.reset (buffering_strategy);
long flags = THR_NEW_LWP | THR_DETACHED;
CORBA::ORB_var orb =
TAO_Notify_PROPERTIES::instance()->orb ();
flags |=
orb->orb_core ()->orb_params ()->thread_creation_flags ();
// Guards the thread for auto-deletion; paired with close.
// This is done in the originating thread before the spawn to
// avoid any race conditions.
for ( CORBA::ULong i = 0; i < tp_params.static_threads; ++i )
{
this->_incr_refcnt();
}
// Become an active object.
if (this->ACE_Task <ACE_NULL_SYNCH>::activate (flags,
tp_params.static_threads,
0,
ACE_THR_PRI_OTHER_DEF) == -1)
{
// Undo the ref counts on error
for ( CORBA::ULong i = 0; i < tp_params.static_threads; ++i )
{
this->_decr_refcnt();
}
if (ACE_OS::last_error () == EPERM)
ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Insufficient privilege.\n")));
else if (ACE_OS::last_error () == EAGAIN)
{
ORBSVCS_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) task activation at priority %d failed %p\n"),
tp_params.default_priority, "activate"));
throw CORBA::NO_RESOURCES ();
}
throw CORBA::BAD_PARAM ();
}
}
示例5: TAO_EC_Reactive_Timeout_Generator
TAO_EC_Timeout_Generator*
TAO_EC_Null_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *)
{
int argc = 0;
ACE_TCHAR **argv = 0;
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
ACE_Reactor *reactor = orb->orb_core ()->reactor ();
return new TAO_EC_Reactive_Timeout_Generator (reactor);
}
示例6:
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Notify_Timer_Reactor::TAO_Notify_Timer_Reactor (void)
:reactor_ (0)
{
// Get the ORB
CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb ();
this->reactor_ = orb->orb_core ()->reactor ();
}
示例7: orb_run_task
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize an ORB
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
// Create a holder for the common ORB Objects.
TAO_Notify_ORB_Objects orb_objects;
orb_objects.init (orb);
/* Run the ORB in a separate thread */
TAO_Notify_ORB_Run_Task orb_run_task (orb_objects);
/* Create a Client */
TAO_Notify_Lanes_Supplier_Client client (orb_objects);
if (client.parse_args (argc, argv) != 0)
{
ACE_DEBUG ((LM_DEBUG, "Supplier_Client::Error parsing options\n"));
return -1;
}
long flags = THR_NEW_LWP | THR_JOINABLE;
flags |=
orb->orb_core ()->orb_params ()->thread_creation_flags ();
/* Both the tasks initialize themselves at Priority 0*/
if (orb_run_task.activate (flags) == -1 || client.activate (flags) == -1)
{
if (ACE_OS::last_error () == EPERM)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Insufficient privilege to activate ACE_Task.\n")),
-1);
else
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("(%t) Task activation at priority %d failed.\n")));
}
orb_run_task.thr_mgr ()->wait ();
client.thr_mgr ()->wait ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (ACE_TEXT ("Supplier Client error "));
}
return 0;
}
示例8: task
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc,
argv);
int result =
parse_args (argc, argv);
if (result != 0)
return result;
// Make sure we can support multiple priorities that are required
// for this test.
check_supported_priorities (orb.in ());
// Thread Manager for managing task.
ACE_Thread_Manager thread_manager;
// Create task.
Task task (thread_manager,
orb.in ());
// Task activation flags.
long flags =
THR_NEW_LWP |
THR_JOINABLE |
orb->orb_core ()->orb_params ()->thread_creation_flags ();
// Activate task.
result =
task.activate (flags);
ACE_ASSERT (result != -1);
ACE_UNUSED_ARG (result);
// Wait for task to exit.
result =
thread_manager.wait ();
ACE_ASSERT (result != -1);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return -1;
}
return 0;
}
示例9: pause
void pause()
{
// get the reactor and set the timer.
CORBA::ORB_var orb = TheServiceParticipant->get_ORB ();
ACE_Reactor* reactor ;
reactor = orb->orb_core()->reactor();
if (reactor->schedule_timer(this,
0,
ACE_Time_Value(0,1)) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: PauseReactor, ")
ACE_TEXT(" %p. \n"), "schedule_timer"));
}
}
示例10:
int
TAO_Notify_Tests_Periodic_Supplier::activate_task (ACE_Barrier* barrier)
{
barrier_ = barrier;
long flags = THR_NEW_LWP | THR_JOINABLE;
// Resolve the ORB
CORBA::ORB_var orb;
LOOKUP_MANAGER->resolve (orb);
flags |=
orb->orb_core ()->orb_params ()->thread_creation_flags ();
TAO_Notify_Tests_Priority_Mapping* priority_mapping;
LOOKUP_MANAGER->resolve (priority_mapping);
CORBA::Short native_prio;
priority_mapping->to_native (this->priority_, native_prio);
// Become an active object.
if (this->ACE_Task <ACE_SYNCH>::activate (flags,
1,
0,
native_prio) == -1)
{
if (ACE_OS::last_error () == EPERM)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Insufficient privilege to activate ACE_Task.\n")),
-1);
else
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("(%t) Task activation at priority %d failed, ")
ACE_TEXT ("exiting!\n%a"),
this->priority_,
-1));
}
ACE_DEBUG ((LM_ERROR, "Activated Periodic Supplier Thread at priority %d\n", this->priority_));
return 0;
}
示例11: catch
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
// scope TSS holder within main scope
// so we're certain it gets destroyed before the
// ACE object manager
ACE_TSS<Worker> workers_;
// provide global access
workers_p = &workers_;
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
// Make sure the reactor is initialised in the leader_follower
ACE_Reactor* reactor = orb->orb_core ()->leader_follower ().reactor ();
TEST_ASSERT ((reactor != 0));
// Ready to go
Test_1 (orb->orb_core ());
Test_2 (orb->orb_core ());
Test_3 (orb->orb_core ());
Test_4 (orb->orb_core ());
Test_5 (orb->orb_core ());
Test_6 (orb->orb_core ());
Test_7 (orb->orb_core ());
Test_8 (orb->orb_core ());
Test_9 (orb->orb_core ());
Test_10 (orb->orb_core ());
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing complete.\n")));
// cleanup
orb->destroy ();
}
catch (CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught:");
return 1;
}
return 0;
}
示例12: TAO_EC_Reactive_Timeout_Generator
TAO_EC_Timeout_Generator*
TAO_EC_Default_Factory::create_timeout_generator (TAO_EC_Event_Channel_Base *)
{
if (this->timeout_ == 0)
{
int argc = 0;
ACE_TCHAR **argv = 0;
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, this->orbid_.c_str ());
ACE_Reactor *reactor = orb->orb_core ()->reactor ();
return new TAO_EC_Reactive_Timeout_Generator (reactor);
}
#if 0
else if (this->timeout_ == 1)
{
}
#endif
return 0;
}
示例13: owner_transfer
//.........这里部分代码省略.........
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
// Let the client perform the test in a separate thread
Handler* handler = 0;
ACE_NEW_RETURN (handler,
Handler,
1);
PortableServer::ServantBase_var owner_transfer(handler);
PortableServer::ObjectId_var id =
root_poa->activate_object (handler);
CORBA::Object_var object2 = root_poa->id_to_reference (id.in ());
A::AMI_AMI_TestHandler_var hello = A::AMI_AMI_TestHandler::_narrow (object2.in ());
object2 = CORBA::Object::_nil ();
server->shutdown (); // oneway, so returns here immediately but server waits 5 sec
Client client (server.in (), niterations, hello.in ());
if (client.activate (THR_NEW_LWP | THR_JOINABLE,
nthreads) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot activate client threads\n"),
1);
// Main thread collects replies. It needs to collect
// <nthreads*niterations> replies.
number_of_replies = nthreads *niterations;
if (debug)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) : Entering perform_work loop to receive <%d> replies\n",
number_of_replies));
}
// ORB loop.
ACE_Time_Value tv (1,0);
orb->run (tv);
if (debug)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) : Exited perform_work loop Received <%d> replies\n",
(nthreads*niterations) - number_of_replies));
}
ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
client.wait ();
tv = ACE_Time_Value (1,0);
orb->run (tv);
root_poa->deactivate_object (id.in ());
root_poa->destroy (1, // ethernalize objects
0); // wait for completion
hello = A::AMI_AMI_TestHandler::_nil ();
root_poa = PortableServer::POA::_nil ();
poa_object = CORBA::Object::_nil ();
object = CORBA::Object::_nil ();
server = A::AMI_Test::_nil ();
poa_manager = PortableServer::POAManager::_nil ();
client.clear ();
orb->shutdown ();
orb->destroy ();
CORBA::ULong ref_count = orb->_refcount();
if (ref_count > 1)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Refcount orb %d\n"), ref_count));
++parameter_corruption;
}
else
{
TAO_ORB_Core* core = orb->orb_core ();
if (core != 0)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Core <> null\n")));
++parameter_corruption;
}
}
orb = CORBA::ORB::_nil ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Caught exception:");
return 1;
}
return parameter_corruption;
}
示例14: props
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// The usual server side boilerplate code.
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (obj.in ());
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
// "built-in" strategies are the following:
// 0 = RoundRobin
// 1 = Random
// 2 = LeastLoaded
int default_strategy = 1;
// Check the non-ORB arguments.
::parse_args (argc,
argv,
default_strategy);
TAO_LB_LoadManager * lm = 0;
ACE_NEW_THROW_EX (lm,
TAO_LB_LoadManager(::ping_timeout_milliseconds,
::ping_interval_seconds),
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
ENOMEM),
CORBA::COMPLETED_NO));
PortableServer::ServantBase_var safe_lm = lm;
// Initalize the LoadManager servant.
lm->initialize (orb->orb_core ()->reactor (),
orb.in (),
root_poa.in ());
PortableGroup::Properties props (1);
props.length (1);
props[0].nam.length (1);
props[0].nam[0].id =
CORBA::string_dup ("org.omg.CosLoadBalancing.StrategyInfo");
CosLoadBalancing::StrategyInfo strategy_info;
switch (default_strategy)
{
case 0:
strategy_info.name = CORBA::string_dup ("RoundRobin");
break;
case 1:
strategy_info.name = CORBA::string_dup ("Random");
break;
case 2:
strategy_info.name = CORBA::string_dup ("LeastLoaded");
break;
default:
ORBSVCS_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("ERROR: LoadBalancer internal error.\n")
ACE_TEXT (" Unknown built-in strategy.\n")),
-1);
}
props[0].val <<= strategy_info;
lm->set_default_properties (props);
CosLoadBalancing::LoadManager_var load_manager =
lm->_this ();
CORBA::String_var str =
orb->object_to_string (load_manager.in ());
// to support corbaloc
// Get a reference to the IOR table.
CORBA::Object_var tobj = orb->resolve_initial_references ("IORTable");
IORTable::Table_var table = IORTable::Table::_narrow (tobj.in ());
// bind your stringified IOR in the IOR table
table->bind ("LoadManager", str.in ());
FILE * lm_ior = ACE_OS::fopen (lm_ior_file, "w");
ACE_OS::fprintf (lm_ior, "%s", str.in ());
ACE_OS::fclose (lm_ior);
#if defined (linux) && defined (ACE_HAS_THREADS)
if (ACE_Thread_Manager::instance ()->spawn (::TAO_LB_run_load_manager,
orb.in ()) == -1)
//.........这里部分代码省略.........
示例15: 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 ();
CORBA::Object_var object =
orb->resolve_initial_references ("PolicyCurrent");
CORBA::PolicyCurrent_var policy_current =
CORBA::PolicyCurrent::_narrow (object.in ());
if (CORBA::is_nil (policy_current.in ()))
{
ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n"));
return 1;
}
CORBA::Any scope_as_any;
scope_as_any <<= Messaging::SYNC_NONE;
CORBA::PolicyList policies (1); policies.length (1);
policies[0] =
orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE,
scope_as_any);
policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);
policies[0]->destroy ();
if (parse_args (argc, argv) != 0)
return 1;
// Get the sender reference..
CORBA::Object_var tmp =
orb->string_to_object(ior);
Test::Sender_var sender =
Test::Sender::_narrow(tmp.in ());
if (CORBA::is_nil (sender.in ()))
{
ACE_ERROR_RETURN ((LM_DEBUG,
"Nil coordinator reference <%s>\n",
ior),
1);
}
Client_Task client_task (orb.in(),
sender.in (),
ACE_Thread_Manager::instance (),
number_of_oneways);
Server_Task server_task (orb.in (),
ACE_Thread_Manager::instance ());
// Before creating threads we will let the sender know that we
// will have two threads that would make invocations..
// this is the first oneway we do, so after this we would have a queue
// on one of the transports
sender->active_objects ((CORBA::Short) number_of_client_tasks);
TAO::Transport_Cache_Manager& manager = orb->orb_core()->lane_resources ().transport_cache ();
TAO::Transport_Cache_Manager::HASH_MAP& cachemap = manager.map();
TAO::Transport_Cache_Manager::HASH_MAP_ITER end_iter = cachemap.end ();
bool tranportwithqueue = false;
for (TAO::Transport_Cache_Manager::HASH_MAP_ITER iter = cachemap.begin ();
iter != end_iter;
++iter)
{
TAO_Transport* transport = (*iter).int_id_.transport ();
if (transport->queue_is_empty() == 0 && transport->is_connected() == false)
{
tranportwithqueue = true;
break;
}
}
if (!tranportwithqueue)
{
ACE_ERROR ((LM_ERROR, "(%P|%t) Error: expect a not connected transport with a queue\n"));
}
else
{
//.........这里部分代码省略.........