本文整理汇总了C++中cosnotifychanneladmin::SupplierAdmin_var类的典型用法代码示例。如果您正苦于以下问题:C++ SupplierAdmin_var类的具体用法?C++ SupplierAdmin_var怎么用?C++ SupplierAdmin_var使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SupplierAdmin_var类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
static CosNotifyChannelAdmin::SupplierAdmin_ptr
create_supplieradmin (CosNotifyChannelAdmin::EventChannel_ptr ec)
{
CosNotifyChannelAdmin::AdminID adminid = 0;
CosNotifyChannelAdmin::SupplierAdmin_var admin =
ec->new_for_suppliers (CosNotifyChannelAdmin::AND_OP, adminid);
return CosNotifyChannelAdmin::SupplierAdmin::_duplicate (admin.in ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:9,代码来源:Structured_Supplier.cpp
示例2:
template <class SERVANT_TYPE> CosNotifyChannelAdmin::SupplierAdmin_ptr
TAO_Notify_ProxyConsumer_T<SERVANT_TYPE>::MyAdmin (void)
{
CosNotifyChannelAdmin::SupplierAdmin_var ret;
CORBA::Object_var object = this->supplier_admin().ref ();
ret = CosNotifyChannelAdmin::SupplierAdmin::_narrow (object.in ());
return ret._retn ();
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:11,代码来源:ProxyConsumer_T.cpp
示例3: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int status = 0;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 1);
CORBA::ORB_ptr orb = client.orb ();
CORBA::Object_var object =
orb->string_to_object (ior);
MonitorTestInterface_var sig =
MonitorTestInterface::_narrow (object.in ());
if (CORBA::is_nil (sig.in ()))
ACE_ERROR_RETURN ((LM_ERROR, "Error: Structured Supplier: Narrow to MonitorTestInterface failed.\n"),1);
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
if (!CORBA::is_nil (admin.in ()))
{
create_suppliers (admin.in (), client.root_poa ());
sig->running (MonitorTestInterface::Supplier);
ACE_DEBUG ((LM_DEBUG,
"1 supplier sending %d events...\n", max_events));
for (int i = 0; i < max_events; ++i)
{
ACE_DEBUG ((LM_DEBUG, "+"));
SendEvent (i);
}
ACE_DEBUG ((LM_DEBUG,
"\nSupplier sent %d events.\n", max_events));
sig->finished (MonitorTestInterface::Supplier);
supplier_1->disconnect ();
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Supplier Error: ");
status = 1;
}
return status;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:51,代码来源:Structured_Supplier.cpp
示例4: execute
virtual bool execute (const char* command) {
if (ACE_OS::strcmp (command, TAO_NS_CONTROL_REMOVE_SUPPLIERADMIN) == 0)
{
CosNotifyChannelAdmin::SupplierAdmin_var admin =
this->ec_->get_supplieradmin (this->id_);
if (!CORBA::is_nil (admin.in ()))
admin->destroy ();
}
else
{
return false;
}
return true;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:15,代码来源:MonitorSupplierAdmin.cpp
示例5:
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;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:44,代码来源:IdAssignment.cpp
示例6: ecf_name
//.........这里部分代码省略.........
if (!ACE::is_equal (count, 0.0))
{
error ("Invalid active event channel count");
}
stat_name =
ecf_name
+ "/"
+ ACE_CString (NotifyMonitoringExt::InactiveEventChannelNames);
stat = instance->get (stat_name);
if (stat == 0)
{
error ("Could not find InactiveEventChannels statistic");
}
stat->update ();
Monitor_Control_Types::NameList list = stat->get_list ();
if (list.size () != 1)
{
error ("Invalid inactive event channel list");
}
ACE_CString full_ec_name (ecf_name + "/" + ec_name);
if (list[0] != full_ec_name)
{
error ("Wrong event channel name");
}
CosNotifyChannelAdmin::AdminID aid;
CosNotifyChannelAdmin::SupplierAdmin_var admin =
mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP,
aid,
"TestSupplierAdmin");
try
{
admin =
mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP,
aid,
"TestSupplierAdmin");
error ("Expected a SupplierAdmin "
"NotifyMonitoringExt::NameAlreadyUsed exception");
}
catch (const NotifyMonitoringExt::NameAlreadyUsed&)
{
// This is expected.
};
// We should be able to create another one with the same name.
admin->destroy ();
admin =
mec->named_new_for_suppliers (CosNotifyChannelAdmin::AND_OP,
aid,
"TestSupplierAdmin");
NotifyMonitoringExt::SupplierAdmin_var madmin =
NotifyMonitoringExt::SupplierAdmin::_narrow (admin.in ());
if (CORBA::is_nil (madmin.in ()))
{
error ("Could not narrow the supplier admin");
开发者ID:asdlei00,项目名称:ACE,代码行数:67,代码来源:MonitorControlExt.cpp
示例7: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int status = 0;
ACE_Auto_Ptr< sig_i > sig_impl;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
if (use_deadline_ordering)
{
CosNotification::QoSProperties qos (1);
qos.length (1);
qos[0].name = CORBA::string_dup (CosNotification::OrderPolicy);
qos[0].value <<= (CORBA::Short)CosNotification::DeadlineOrder;
ec->set_qos (qos);
}
sig_impl.reset( new sig_i( client.orb() ) );
sig_var sig = sig_impl->_this ();
// If the ior_output_file exists, output the ior to it
if (ior_output_file != 0)
{
CORBA::String_var ior =
client.orb ()->object_to_string (sig.in ());
FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
ACE_ASSERT (output_file != 0);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
ACE_ASSERT(!CORBA::is_nil (admin.in ()));
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, "1 supplier sending %d events...\n", num_events));
for (int i = 0; i < num_events; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendEvent (i + 1);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier sent %d events.\n", num_events));
sig_impl->wait_for_completion();
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect();
ec->destroy();
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
status = 1;
}
return status;
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:71,代码来源:Structured_Supplier.cpp
示例8: 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;
//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,代码来源:supplier.cpp
示例9: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int status = 0;
ACE_Auto_Ptr< sig_i > sig_impl;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
static const char* ec_name = "MyEventChannel";
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel (ec_name, 0);
static const int max = 20;
int count = 0;
while(ACE_OS::access(ACE_TEXT_ALWAYS_CHAR(notify2ior), R_OK) == -1 && count < max)
{
ACE_OS::sleep (1);
count++;
}
if (count >= max)
{
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: Timed out waiting for the "
"second notify service\n"),
1);
}
ACE_OS::sleep (2);
// Due to the way that connections are handled, we need to
// perform the new event channel creation twice to flush out
// the connection to the first notification service
try
{
ec = client.create_event_channel (ec_name, 0);
}
catch (const CORBA::TRANSIENT&)
{
}
catch (const CORBA::COMM_FAILURE&)
{
}
ec = client.create_event_channel (ec_name, 0);
CORBA::ORB_ptr orb = client.orb ();
// Activate the signaler with the POA
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.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 %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
if (!CORBA::is_nil (admin.in ()))
{
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, "1 supplier sending %d events...\n", max_events));
for (int i = 0; i < max_events; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendEvent (i);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier sent %d events.\n", max_events));
sig_impl->wait_for_completion();
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect();
ec->destroy();
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
//.........这里部分代码省略.........
开发者ID:akostrikov,项目名称:ATCD,代码行数:101,代码来源:Structured_Supplier.cpp
示例10: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
int status = 0;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CORBA::ORB_ptr orb = client.orb ();
sig_i* sig_impl;
ACE_NEW_RETURN (sig_impl, sig_i (orb), 1);
PortableServer::ServantBase_var owner_transfer(sig_impl);
CORBA::Object_var object =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (object.in ());
PortableServer::ObjectId_var id =
root_poa->activate_object (sig_impl);
object = root_poa->id_to_reference (id.in ());
sig_var sig = sig::_narrow (object.in ());
CORBA::String_var ior = orb->object_to_string (sig.in ());
// Output the IOR to the <ior_output_file>
FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
if (output_file != 0)
{
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
if (!CORBA::is_nil (admin.in ()))
{
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG ((LM_DEBUG,
"1 supplier sending %d events...\n", max_events));
for (int i = 0; i < max_events; ++i)
{
ACE_DEBUG ((LM_DEBUG, "+"));
SendEvent (i);
}
ACE_DEBUG ((LM_DEBUG,
"\nSupplier sent %d events.\n", max_events));
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect ();
ec->destroy ();
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Supplier Error: ");
status = 1;
}
return status;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:74,代码来源:Structured_Supplier.cpp
示例11: argcon
int
ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
int status = 0;
ACE_Auto_Ptr<sig_i> sig_impl;
try
{
Supplier_Client client;
ACE_Argv_Type_Converter argcon (argc, argv);
status = client.init (argcon.get_argc (), argcon.get_TCHAR_argv ());
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
sig_impl.reset (new sig_i (client.orb ()));
sig_var sig = sig_impl->_this ();
// If the ior_output_file exists, output the ior to it
if (ior_output_file != 0)
{
CORBA::String_var ior =
client.orb ()->object_to_string (sig.in ());
FILE *output_file= ACE_OS::fopen (ior_output_file, ACE_TEXT ("w"));
ACE_ASSERT (output_file != 0);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
ACE_ASSERT (!CORBA::is_nil (admin.in ()));
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup ();
// If this is changed, you should update max_events
// found in Notify_Push_Consumer.cpp
int batch_size = 4;
int num_events = 80 / batch_size;
ACE_DEBUG ((LM_DEBUG,
"1 supplier sending %d batches of %d events...\n",
num_events, batch_size));
CosNotification::EventBatch events;
events.length(batch_size);
for (int i = 0; i < num_events; ++i)
{
supplier_1->send_events (events);
}
ACE_DEBUG ((LM_DEBUG, "\nSupplier sent %d events.\n", num_events));
sig_impl->wait_for_completion ();
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect ();
ec->destroy ();
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
status = 1;
}
return status;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:71,代码来源:Supplier.cpp
示例12: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Auto_Ptr< sig_i > sig_impl;
int status = 0;
try
{
Supplier_Client client;
status = client.init (argc, argv);
if (status == 0)
{
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CORBA::ORB_ptr orb = client.orb ();
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.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 %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
if (!CORBA::is_nil (admin.in ()))
{
create_suppliers(admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, " 1 supplier sending %d batches of %d events...\n", num_batches, PER_BATCH));
for (int i = 0; i < num_batches; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendEvents (i);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier waiting for consumer completion...\n"));
sig_impl->wait_for_completion();
ACE_DEBUG((LM_DEBUG, "\nSupplier finished.\n"));
ACE_OS::unlink (ior_output_file);
ec->destroy();
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: Supplier exception: ");
status = 1;
}
return status;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:72,代码来源:Sequence_Supplier.cpp
示例13: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Auto_Ptr< sig_i > sig_impl;
try
{
Supplier_Client client;
int status = client.init (argc, argv);
ACE_UNUSED_ARG(status);
ACE_ASSERT(status == 0);
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CosNotification::QoSProperties qos (1);
qos.length (1);
qos[0].name = CORBA::string_dup (CosNotification::OrderPolicy);
qos[0].value <<= order_policy;
ec->set_qos (qos);
CORBA::ORB_ptr orb = client.orb ();
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.in ());
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 %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
ACE_ASSERT(!CORBA::is_nil (admin.in ()));
create_suppliers (admin.in (), client.root_poa ());
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, "1 supplier sending %d events...\n", num_events));
for (int i = 0; i < num_events / BATCH_SIZE; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendBatch (i);
}
ACE_DEBUG((LM_DEBUG, "\nSupplier sent %d events.\n", num_events));
sig_impl->wait_for_completion();
ACE_OS::unlink (ior_output_file);
supplier_1->disconnect();
ec->destroy();
return 0;
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
}
return 1;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:73,代码来源:Sequence_Supplier.cpp
示例14: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Auto_Ptr< sig_i > sig_impl;
try
{
Consumer_Client client;
int status = client.init (argc, argv);
ACE_UNUSED_ARG(status);
ACE_ASSERT(status == 0);
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("MyEventChannel", 0);
CORBA::ORB_ptr orb = client.orb ();
sig_impl.reset( new sig_i( orb ) );
sig_var sig = sig_impl->_this ();
CORBA::String_var ior =
orb->object_to_string (sig.in ());
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 %s for "
"writing IOR: %C",
ior_output_file,
ior.in ()),
1);
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
}
CosNotifyChannelAdmin::SupplierAdmin_var admin =
create_supplieradmin (ec.in ());
ACE_ASSERT(!CORBA::is_nil (admin.in ()));
create_suppliers (admin.in (), &client);
sig_impl->wait_for_startup();
ACE_DEBUG((LM_DEBUG, "%i supplier(s) sending %d events...\n", supplier_count, event_count));
for (int i = 0; i < event_count; ++i)
{
ACE_DEBUG((LM_DEBUG, "+"));
SendEvent (i);
}
ACE_DEBUG((LM_DEBUG, "\nEach Supplier sent %d events.\n", event_count));
sig_impl->wait_for_completion();
ACE_OS::unlink (ior_output_file);
disconnect_suppliers();
ec->destroy();
return 0;
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
}
return 1;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:67,代码来源:Structured_Supplier.cpp
示例15: main
int main(int argc, char* argv[]) {
char aux1[1000];
time_t seconds;
signal(SIGINT, TerminarEjecucion);
time(&seconds);
srand((unsigned int) seconds);
try {
// Inicializacion del ORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "");
// Recoge la referencia al canal
cin >> aux1;
CORBA::Object_var obj = orb->string_to_object(aux1);
// Obtiene el canal
CosNotifyChannelAdmin::EventChannel_var channel;
channel = CosNotifyChannelAdmin::EventChannel::_narrow(obj);
if (CORBA::is_nil(channel)) {
cerr << "[supplier2] ERROR: canal nulo " << endl;
return -1;
}
// Obtiene el SupplierAdmin
CosNotifyChannelAdmin::AdminID id;
_supplier_admin =
channel->new_for_suppliers(CosNotifyChannelAdmin::AND_OP, id);
cerr << "[supplier2] SupplierAdminId = " << id << endl;
CosNotifyChannelAdmin::ProxyID proxy_id;
CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
_supplier_admin->obtain_notification_push_consumer(
CosNotifyChannelAdmin::STRUCTURED_EVENT,
proxy_id);
cerr << "[supplier2] ProxyId = " << proxy_id << endl;
// Obtiene el StructuredProxyPushConsumer
_consumer =
CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(proxy_consumer);
try{
CosNotifyComm::StructuredPushSupplier_var supplier =
CosNotifyComm::StructuredPushSupplier::_nil();
_consumer->connect_structured_push_supplier(supplier);
if (_consumer == NULL) cerr << "[supplier2] consumer NULO 5" << endl;
} catch (CORBA::Exception& exc) {
cerr << "[supplier2] Exception in _consumer->connect_push_supplier(...)";
cerr << exc << endl;
} catch (...) {
cerr << "[supplier2] Unknowed exception ";
cerr << "in _consumer->connect_push_supplier(...)";
}
#ifdef _TAO
sleep(1);
#elif defined _TIDORB
TIDThr::Thread::sleep(1000); // 1 ''
#endif
cerr << "[supplier2] Crea un structured event" << flush << endl;
try{
CosNotification::StructuredEvent* event = NULL;
int rnd = 0;
for(int i=0; i < 200; i++) {
rnd = rand();
TimeBase::UtcT current_utc = TIDorb::core::util::Time::currentUtcT();
TimeBase::UtcT future_utc = TIDorb::core::util::Time::currentUtcT();
TimeBase::UtcT pass_utc = TIDorb::core::util::Time::currentUtcT();
future_utc.time += (5 * 10000000); // now + 5 ''
pass_utc.time -= (5 * 10000000); // now - 5 ''
// Rellenamos la informacion del evento
event = new CosNotification::StructuredEvent();
event->header.fixed_header.event_name =
(rnd % 2) ? CORBA::string_dup("event_name") : CORBA::string_dup("other");
event->header.fixed_header.event_type.domain_name =
(rnd % 2) ? CORBA::string_dup("domain_name") : CORBA::string_dup("other");
event->header.fixed_header.event_type.type_name =
(rnd % 2) ? CORBA::string_dup("type_name") : CORBA::string_dup("other");
event->header.variable_header.length(5);
event->header.variable_header[0].name = CORBA::string_dup("EventReliability");
event->header.variable_header[0].value <<= (CORBA::Short) 0;
event->header.variable_header[1].name = CORBA::string_dup("Priority");
//.........这里部分代码省略.........
开发者ID:AlvaroVega,项目名称:TIDNotifC,代码行数:101,代码来源:supplier2.C
示例16: TerminarEjecucion
void TerminarEjecucion (int){
cerr << "CTRL-C recibido: Terminado ejecucion..." << endl;
_consumer->disconnect_structured_push_consumer();
_supplier_admin->destroy();
exit(0);
}
开发者ID:AlvaroVega,项目名称:TIDNotifC,代码行数:6,代码来源:supplier2.C
注:本文中的cosnotifychanneladmin::SupplierAdmin_var类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论