本文整理汇总了C++中cosnotifychanneladmin::EventChannel_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ EventChannel_var::in方法的具体用法?C++ EventChannel_var::in怎么用?C++ EventChannel_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotifychanneladmin::EventChannel_var
的用法示例。
在下文中一共展示了EventChannel_var::in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
IdAssignment::destroy_supplier_admin (
CosNotifyChannelAdmin::ChannelID channel_id,
CosNotifyChannelAdmin::AdminID admin_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"));
}
CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
ec->get_supplieradmin (admin_id);
if (CORBA::is_nil (supplier_admin.in ()))
ACE_ERROR ((LM_ERROR,
" (%P|%t) Unable to get supplier admin\n"));
supplier_admin->destroy ();
if (TAO_debug_level)
ACE_DEBUG ((LM_DEBUG,
"destroyed supplier admin\n"));
}
示例2: 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;
}
示例3: OnButton
B21BehavioursFactory::B21BehavioursFactory(Miro::Server& _server,
ACE_Reactor& _reactor)
{
std::cout << "Constructing B21BehavioursFactory." << std::endl;
// optain references
CosNotifyChannelAdmin::EventChannel_var ec =
_server.resolveName<CosNotifyChannelAdmin::EventChannel>("EventChannel");
Miro::RangeSensor_var sonar =
_server.resolveName<Miro::RangeSensor>("Sonar");
Miro::RangeSensor_var laser =
_server.resolveName<Miro::RangeSensor>("Laser");
// initialize behaviours
eventBehaviours_.push_back(new OnButton(ec.in(),
_server.namingContextName));
eventBehaviours_.push_back(new SonarAvoid(sonar.in(),
ec.in(),
_server.namingContextName));
timedBehaviours_.push_back(new LaserAvoid(_reactor,
laser.in()));
}
示例4: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int status = 0;
try
{
Consumer_Client client;
status = client.init (argc, argv);
ACE_UNUSED_ARG(status);
ACE_ASSERT(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);
sig_var sig = sig::_narrow (object.in ());
ACE_ASSERT(! CORBA::is_nil (sig.in ()));
CosNotifyChannelAdmin::ConsumerAdmin_var admin =
create_consumeradmin (ec.in ());
ACE_ASSERT(!CORBA::is_nil (admin.in ()));
create_consumers (admin.in (), &client);
// Tell the supplier to go
sig->go ();
ACE_DEBUG((LM_DEBUG, "Consumer waiting for events...\n"));
client.ORB_run( );
ACE_DEBUG((LM_DEBUG, "Consumer done.\n"));
consumer_1->disconnect();
sig->done ();
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: ");
status = 1;
}
return status;
}
示例5: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
int status = 0;
try
{
Consumer_Client client;
status = client.init (argc, argv);
if (status != 0)
ACE_ERROR_RETURN ((LM_ERROR, "Error: Client init failed.\n"),1);
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);
sig_var sig = sig::_narrow (object.in ());
CosNotifyChannelAdmin::ConsumerAdmin_var admin =
create_consumeradmin (ec.in ());
if (CORBA::is_nil (admin.in ()))
ACE_ERROR_RETURN ((LM_ERROR, "Error: nil ConsumerAdmin.\n"),1);
create_consumers (admin.in (), &client);
ACE_DEBUG ((LM_DEBUG, "\nConsumer waiting for events...\n"));
sig->go ();
ACE_Time_Value tv (5);
orb->run (tv);
ACE_DEBUG ((LM_DEBUG, "Consumer done.\n"));
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Consumer Error: ");
status = 1;
}
return status;
}
示例6: catch
void
TAO_CosNotify_Service::finalize_service (
CosNotifyChannelAdmin::EventChannelFactory_ptr factory)
{
// Get out early if we can
if (CORBA::is_nil (factory))
return;
// Make sure the factory doesn't go away while we're in here
CosNotifyChannelAdmin::EventChannelFactory_var ecf =
CosNotifyChannelAdmin::EventChannelFactory::_duplicate (factory);
// Find all the consumer admin objects and shutdown the worker tasks
CosNotifyChannelAdmin::ChannelIDSeq_var channels =
ecf->get_all_channels ();
CORBA::ULong length = channels->length ();
for(CORBA::ULong i = 0; i < length; i++)
{
try
{
CosNotifyChannelAdmin::EventChannel_var ec =
ecf->get_event_channel (channels[i]);
if (!CORBA::is_nil (ec.in ()))
{
TAO_Notify_EventChannel* nec =
dynamic_cast<TAO_Notify_EventChannel*> (ec->_servant ());
if (nec != 0)
nec->destroy ();
}
}
catch (const CORBA::Exception&)
{
// We're shutting things down, so ignore exceptions
}
}
TAO_Notify_EventChannelFactory* necf =
dynamic_cast<TAO_Notify_EventChannelFactory*> (ecf->_servant ());
if (necf != 0)
necf->stop_validator();
}
示例7:
void
TAO_Notify_Tests_EventChannel_Command::handle_create (void)
{
if (this->collocated_ == 1)
{
this->create_collocated_ecf ();
}
CosNotifyChannelAdmin::EventChannelFactory_var ec_factory;
LOOKUP_MANAGER->resolve (ec_factory , TAO_Notify_Tests_Name::event_channel_factory);
CosNotification::QoSProperties qos;
CosNotification::AdminProperties admin;
// Create an event channel
CosNotifyChannelAdmin::EventChannel_var ec =
ec_factory->create_channel (qos,
admin,
this->id_);
LOOKUP_MANAGER->_register (ec.in(), this->name_.c_str ());
}
示例8: catch
/**
* Processing of the configuration file parameters.
*/
void
BallDetectionEventChannel::init(Miro::Server& _server, Video::FilterParameters const * _params)
{
// Super class initialization.
Super::init(_server, _params);
// Set up the interface
try {
// Get reference to the event channel
CosNotifyChannelAdmin::EventChannel_var ec =
_server.resolveName<CosNotifyChannelAdmin::EventChannel>("EventChannel");
supplier_ = new Miro::StructuredPushSupplier(ec.in(), _server.namingContextName.c_str());
// Define the event type which is published
Miro::StructuredPushSupplier::
initStructuredEvent(event_, supplier_->domainName(), "BallResult");
// Register the event at the event channel
supplier_->addOffer(event_);
}
catch (const CORBA::Exception& e) {
std::cerr << "Set up event publication failed: " << std::endl;
}
}
示例9: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
int status = 0;
try
{
Consumer_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);
sig_var sig = sig::_narrow (object.in ());
if (CORBA::is_nil (sig.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil\n",
ior),
1);
}
CosNotifyChannelAdmin::ConsumerAdmin_var admin =
ec->default_consumer_admin();
CosNotifyFilter::Filter_var filter =
create_proxyFilter (ec.in());
if (!CORBA::is_nil (admin.in ()))
{
create_consumers (admin.in (), &client, filter.in());
// Tell the supplier to go
sig->go ();
ACE_Time_Value tv(10, 0);
client.ORB_run(tv);
ACE_DEBUG((LM_DEBUG, "Consumer done.\n"));
sig->done ();
ACE_DEBUG((LM_DEBUG, "Expected %d message(s) and received %d message(s).\n",
expect_fail == 1 ? 0 : 1, consumer_1->messages_received()));
if (1 == expect_fail)
status = consumer_1->messages_received() == 0 ? 0 : 1;
else
status = consumer_1->messages_received() == 1 ? 0 : 1;
ACE_DEBUG((LM_DEBUG, "Test status is %s.\n", status == 1 ? "fail" : "pass"));
}
}
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: Consumer exception: ");
status = 1;
}
return status;
}
示例10: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR * argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var rootObj = orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var rootNC =
CosNaming::NamingContext::_narrow(rootObj.in());
// Get reference to Root POA.
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
// Activate POA manager
PortableServer::POAManager_var mgr = poa->the_POAManager();
mgr->activate();
// Create an Event Channel factory.
CosNotifyChannelAdmin::EventChannelFactory_var notify_factory =
TAO_Notify_EventChannelFactory_i::create(poa.in());
ACE_ASSERT (!CORBA::is_nil (notify_factory.in ()));
// Create an Event Channel.
CosNotifyChannelAdmin::ChannelID id;
CosNotification::QoSProperties initial_qos;
CosNotification::AdminProperties initial_admin;
CosNotifyChannelAdmin::EventChannel_var ec =
notify_factory->create_channel (initial_qos, initial_admin, id);
// Bind it in the Naming Service.
CosNaming::Name name(1);
name.length(1);
name[0].id = CORBA::string_dup("MyEventChannel");
rootNC->rebind(name, ec.in());
// Become a structured push supplier.
CosNotifyChannelAdmin::AdminID adminid;
CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
CosNotifyChannelAdmin::AND_OP;
CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
ec->new_for_suppliers (ifgop, adminid);
CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id;
CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
supplier_admin->obtain_notification_push_consumer(
CosNotifyChannelAdmin::STRUCTURED_EVENT,
supplieradmin_proxy_id);
StructuredEventSupplier_i *servant =
new StructuredEventSupplier_i(orb.in());
CosNotifyComm::StructuredPushSupplier_var supplier = servant->_this();
CosNotifyChannelAdmin::StructuredProxyPushConsumer_var consumer_proxy =
CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(
proxy_consumer.in());
consumer_proxy->connect_structured_push_supplier(supplier.in());
// Set up events to push.
CosNotification::StructuredEvent event;
event.header.fixed_header.event_type.domain_name =
CORBA::string_dup("OCI_TAO");
event.header.fixed_header.event_type.type_name =
CORBA::string_dup("examples");
event.header.fixed_header.event_name = CORBA::string_dup("myevent");
event.filterable_data.length (1);
event.filterable_data[0].name = CORBA::string_dup("Message from:");
event.filterable_data[0].value <<= (const char *)user_name;
event.filterable_data.length (2);
event.filterable_data[1].name = CORBA::string_dup("Subject:");
event.filterable_data[1].value <<= (const char *)subject;
event.filterable_data.length (3);
event.filterable_data[2].name = CORBA::string_dup("Message:");
event.filterable_data[2].value <<= (const char *)message;
// Push events.
while (1) {
std::cout << "pushing " << std::endl;
consumer_proxy->push_structured_event (event);
ACE_OS::sleep (1);
}
}
catch(const CORBA::Exception& ex) {
return 1;
}
return 0;
}
示例11: StructuredEventSupplier_i
Messenger_i::Messenger_i (CORBA::ORB_ptr orb)
: orb_ (CORBA::ORB::_duplicate (orb))
{
CORBA::Object_var naming_obj =
orb_->resolve_initial_references ("NameService");
CosNaming::NamingContext_var naming_context =
CosNaming::NamingContext::_narrow (naming_obj.in());
CosNaming::Name name;
name.length (1);
name[0].id = CORBA::string_dup ("NotifyEventChannelFactory");
CORBA::Object_var obj = naming_context->resolve (name);
CosNotifyChannelAdmin::EventChannelFactory_var notify_factory =
CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in ());
CosNotifyChannelAdmin::ChannelID id;
CosNotification::QoSProperties initial_qos;
CosNotification::AdminProperties initial_admin;
CosNotifyChannelAdmin::EventChannel_var ec =
notify_factory->create_channel (initial_qos,
initial_admin,
id);
name[0].id = CORBA::string_dup ("MyEventChannel");
naming_context->rebind (name, ec.in());
CosNotifyChannelAdmin::AdminID adminid;
CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
CosNotifyChannelAdmin::OR_OP;
CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
ec->new_for_suppliers (ifgop, adminid);
CosNotifyChannelAdmin::ProxyID supplieradmin_proxy_id;
CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
supplier_admin->obtain_notification_push_consumer(
CosNotifyChannelAdmin::STRUCTURED_EVENT,
supplieradmin_proxy_id);
StructuredEventSupplier_i *servant =
new StructuredEventSupplier_i(orb_.in());
CORBA::Object_var poa_obj = orb_->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj.in ());
PortableServer::POAManager_var mgr = poa->the_POAManager ();
mgr->activate ();
PortableServer::ObjectId_var objectId = poa->activate_object (servant);
CORBA::Object_var supplier_obj = poa->id_to_reference (objectId.in ());
CosNotifyComm::StructuredPushSupplier_var supplier =
CosNotifyComm::StructuredPushSupplier::_narrow (supplier_obj.in ());
consumer_proxy_ =
CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (proxy_consumer.in());
consumer_proxy_->
connect_structured_push_supplier (supplier.in());
}
示例12: ecf_name
int
ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
#if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow (obj.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
TAO_Notify_Service* notify_service =
TAO_Notify_Service::load_default ();
if (notify_service == 0)
{
error ("Unable to load the Notify Service");
}
notify_service->init_service (orb.in ());
ACE_OS::sleep (1);
const ACE_CString ecf_name ("MonitoringEventChannelFactory");
CosNotifyChannelAdmin::EventChannelFactory_var ecf =
notify_service->create (poa.in (), ecf_name.c_str ());
NotifyMonitoringExt::EventChannelFactory_var monitor_ec_factory =
NotifyMonitoringExt::EventChannelFactory::_narrow (ecf.in ());
if (CORBA::is_nil (monitor_ec_factory.in ()))
{
error ("Unable to create the Monitoring Event Channel Factory");
}
CosNotification::QoSProperties qos_prop;
CosNotification::AdminProperties admin_prop;
CosNotifyChannelAdmin::ChannelID id;
const ACE_CString ec_name ("test1");
CosNotifyChannelAdmin::EventChannel_var ec =
monitor_ec_factory->create_named_channel (qos_prop,
admin_prop,
id,
ec_name.c_str ());
NotifyMonitoringExt::EventChannel_var mec =
NotifyMonitoringExt::EventChannel::_narrow (ec.in ());
if (CORBA::is_nil (mec.in ()))
{
error ("Unable to narrow the event channel");
}
try
{
CosNotifyChannelAdmin::ChannelID fake_id;
CosNotifyChannelAdmin::EventChannel_var fake =
monitor_ec_factory->create_named_channel (qos_prop,
admin_prop,
fake_id,
"test1");
error ("Expected a NotifyMonitoringExt::"
"NameAlreadyUsed exception");
}
catch (const NotifyMonitoringExt::NameAlreadyUsed&)
{
// This is expected.
}
Monitor_Point_Registry* instance = Monitor_Point_Registry::instance ();
ACE_CString stat_name =
ecf_name
+ "/"
+ ACE_CString (NotifyMonitoringExt::InactiveEventChannelCount);
Monitor_Base* stat = instance->get (stat_name);
if (stat == 0)
{
error ("Could not find InactiveEventChannelCount statistic");
}
stat->update ();
double count = stat->last_sample ();
if (!ACE::is_equal (count, 1.0))
{
error ("Invalid inactive event channel count");
}
stat_name =
ecf_name
+ "/"
+ ACE_CString (NotifyMonitoringExt::ActiveEventChannelCount);
stat = instance->get (stat_name);
//.........这里部分代码省略.........
示例13: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var naming_obj =
orb->resolve_initial_references ("NameService");
if (CORBA::is_nil(naming_obj.in())) {
std::cerr << "Unable to find naming service" << std::endl;
return 1;
}
CosNaming::NamingContext_var naming_context =
CosNaming::NamingContext::_narrow(naming_obj.in());
CosNaming::Name name(1);
name.length (1);
name[0].id = CORBA::string_dup("NotifyEventChannelFactory");
CORBA::Object_var obj = naming_context->resolve(name);
CosNotifyChannelAdmin::EventChannelFactory_var notify_factory =
CosNotifyChannelAdmin::EventChannelFactory::_narrow(obj.in());
if (CORBA::is_nil(notify_factory.in())) {
std::cerr << "Unable to find notify factory" << std::endl;
return 1;
}
name.length (1);
name[0].id = CORBA::string_dup("MyEventChannel");
CORBA::Object_var ecObj = naming_context->resolve(name);
CosNotifyChannelAdmin::EventChannel_var ec =
CosNotifyChannelAdmin::EventChannel::_narrow(ecObj.in());
if (CORBA::is_nil (ec.in())) {
std::cerr << "Unable to find event channel" << std::endl;
return 1;
}
CosNotifyChannelAdmin::AdminID adminid;
CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
CosNotifyChannelAdmin::AND_OP;
CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin =
ec->new_for_consumers(ifgop,
adminid);
if (CORBA::is_nil (consumer_admin.in())) {
std::cerr << "Unable to find consumer admin" << std::endl;
return 1;
}
CosNotifyFilter::FilterFactory_var ffact =
ec->default_filter_factory ();
// setup a filter at the consumer admin
CosNotifyFilter::Filter_var ca_filter =
ffact->create_filter (TCL_GRAMMAR);
if (CORBA::is_nil (ca_filter.in())) {
std::cerr << "Unable to create filetr object" << std::endl;
return 1;
}
CosNotifyFilter::ConstraintExpSeq constraint_list (1);
constraint_list.length (1);
constraint_list[0].event_types.length (0);
constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER);
ca_filter->add_constraints (constraint_list);
consumer_admin ->add_filter (ca_filter.in());
CosNotification::EventTypeSeq added(1);
CosNotification::EventTypeSeq removed (0);
added.length (1);
removed.length (0);
added[0].domain_name = CORBA::string_dup ("*");
added[0].type_name = CORBA::string_dup ("*");
consumer_admin->subscription_change (added, removed);
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
if (CORBA::is_nil (poa_object.in())) {
std::cerr << "Unable to initialize the POA." << std::endl;
return 1;
}
PortableServer::POA_var poa =
PortableServer::POA::_narrow(poa_object.in());
PortableServer::Servant_var<StructuredEventConsumer_i> servant =
new StructuredEventConsumer_i(orb.in());
//.........这里部分代码省略.........
示例14: 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: ");
//.........这里部分代码省略.........
示例15: 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;
}