本文整理汇总了C++中cosnotifychanneladmin::EventChannel_var::default_supplier_admin方法的典型用法代码示例。如果您正苦于以下问题:C++ EventChannel_var::default_supplier_admin方法的具体用法?C++ EventChannel_var::default_supplier_admin怎么用?C++ EventChannel_var::default_supplier_admin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotifychanneladmin::EventChannel_var
的用法示例。
在下文中一共展示了EventChannel_var::default_supplier_admin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
IdAssignment::default_supplier_admin_test (CosNotifyChannelAdmin::ChannelID channel_id)
{
CosNotifyChannelAdmin::EventChannel_var ec =
this->notify_factory_->get_event_channel (channel_id);
if (CORBA::is_nil (ec.in ()))
{
ACE_ERROR((LM_ERROR,
" (%P|%t) Unable to find event channel\n"));
return false;
}
CosNotifyChannelAdmin::SupplierAdmin_var default_supplier_admin =
ec->get_supplieradmin (0);
if (CORBA::is_nil (default_supplier_admin.in()))
{
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to create default supplier admin\n"),
false);
}
CosNotifyChannelAdmin::SupplierAdmin_var def = ec->default_supplier_admin ();
if (CORBA::is_nil (default_supplier_admin.in()))
{
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to get default supplier admin\n"),
false);
}
if (! default_supplier_admin->_is_equivalent(def.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) failed for default supplier admin checking\n"),
false);
}
if (TAO_debug_level)
ACE_DEBUG ((LM_DEBUG,
"passed default supplier admin test.\n"));
return true;
}
示例2: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
PortableServer::POAManager_var poa_manager;
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa_obj.in());
poa_manager = root_poa->the_POAManager();
poa_manager->activate();
/*Get event_channel*/
std::cout << "Create event_channel now" << std::endl;
CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
//Instanciating the Supplier
CosNotifyComm::StructuredPushSupplier_var sps =
CosNotifyComm::StructuredPushSupplier::_nil();
CosNotifyCommImpl::StructuredPushSupplier *pImpl_sps = new CosNotifyCommImpl::StructuredPushSupplier;
sps = pImpl_sps->_this();
//Obtain a Supplier Admin
CosNotifyChannelAdmin::SupplierAdmin_var sa = ec->default_supplier_admin();
if( sa.in() == CosNotifyChannelAdmin::SupplierAdmin::_nil() ){
std::cerr << "sa is nil!" << std::endl;
return 1;
}
//Obtain a Proxy Consumer
CosNotifyChannelAdmin::ProxyID proxy_id;
CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
CosNotifyChannelAdmin::ProxyConsumer_var proxyCon_obj;
try
{
proxyCon_obj = sa->obtain_notification_push_consumer(ctype, proxy_id);
}
catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
{
std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
throw;
}
CosNotifyChannelAdmin::StructuredProxyPushConsumer_var ppc =
CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(proxyCon_obj.in());
//Connecting a Supplier to a Proxy Consumer
try
{
ppc->connect_structured_push_supplier(sps.in());
}
catch (CosEventChannelAdmin::AlreadyConnected ac)
{
std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
throw;
}
catch (CORBA::SystemException& se)
{
std::cerr << "System exception occurred during connect: " <<
se << std::endl;
throw;
}
//Demo::demo_send_heart_beat(ppc);
//Send a Demo Notification
CosNotification::StructuredEvent event;
event.header.fixed_header.event_type.domain_name =
CORBA::string_dup("Test_domain");
event.header.fixed_header.event_type.type_name =
CORBA::string_dup("Test_type_name");
event.header.variable_header.length(0);
event.remainder_of_body <<= "";
std::cout << "Sending a demo event...," << std::endl;
std::cout << "event.header.fixed_header.event_type.domain_name = "
<< event.header.fixed_header.event_type.domain_name
<< std::endl;
std::cout << "event.header.fixed_header.event_type.type_name = "
<< event.header.fixed_header.event_type.type_name
<< std::endl;
try{
ppc->push_structured_event(event);
}
catch (CORBA::SystemException& se)
{
std::cerr << "System exception occurred during push: "
<< se << std::endl;
throw;
//.........这里部分代码省略.........