本文整理汇总了C++中cosnotifychanneladmin::EventChannel_var::default_filter_factory方法的典型用法代码示例。如果您正苦于以下问题:C++ EventChannel_var::default_filter_factory方法的具体用法?C++ EventChannel_var::default_filter_factory怎么用?C++ EventChannel_var::default_filter_factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotifychanneladmin::EventChannel_var
的用法示例。
在下文中一共展示了EventChannel_var::default_filter_factory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TAO_Notify_Tests_Filter_Command::handle_create_filter_factory (void)
{
CosNotifyChannelAdmin::EventChannel_var ec;
LOOKUP_MANAGER->resolve (ec, this->factory_.c_str ());
CosNotifyFilter::FilterFactory_var ff =
ec->default_filter_factory ();
LOOKUP_MANAGER->_register (ff.in(), this->name_.c_str ());
}
示例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();
if (parse_args (argc, argv) != 0)
return 1;
poa_manager->activate();
/*Get event_channel*/
std::cout << "Get event_channel now" << std::endl;
CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
//Instanciating the Consumer
CosNotifyComm::StructuredPushConsumer_var spc =
CosNotifyComm::StructuredPushConsumer::_nil();
CosNotifyCommImpl::StructuredPushConsumer *pImpl_spc = new CosNotifyCommImpl::StructuredPushConsumer;
spc = pImpl_spc->_this();
//Obtain a Consumer Admin
CosNotifyChannelAdmin::AdminID adminid = 0;
CosNotifyChannelAdmin::ConsumerAdmin_var ca =
ec->new_for_consumers (CosNotifyChannelAdmin::AND_OP, adminid);
if( ca.in() == CosNotifyChannelAdmin::ConsumerAdmin::_nil() ){
std::cerr << "ca is nil!" << std::endl;
return 1;
}
//Obtain a Proxy Consumer
CosNotifyChannelAdmin::ProxyID proxy_id;
CosNotifyChannelAdmin::ClientType ctype = CosNotifyChannelAdmin::STRUCTURED_EVENT;
CosNotifyChannelAdmin::ProxySupplier_var proxySupplier_obj;
try
{
proxySupplier_obj = ca->obtain_notification_push_supplier(ctype, proxy_id);
}
catch(CosNotifyChannelAdmin::AdminLimitExceeded err)
{
std::cerr << "CosNotifyChannelAdmin::AdminLimitExceeded Exception!" << std::endl;
throw;
}
CosNotifyChannelAdmin::StructuredProxyPushSupplier_var pps =
CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxySupplier_obj.in());
//Attaching a filter to pps
CosNotifyFilter::FilterFactory_var dff =
ec->default_filter_factory();
ACE_ASSERT(!CORBA::is_nil(dff.in()));
CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
CosNotification::EventTypeSeq event_types(1);
event_types.length(2);
event_types[0].domain_name = CORBA::string_dup("DomainA");
event_types[0].type_name = CORBA::string_dup("TypeA");
event_types[1].domain_name = CORBA::string_dup("DomainB");
event_types[1].type_name = CORBA::string_dup("TypeB");
CosNotifyFilter::ConstraintExpSeq constraints(1);
constraints.length(1);
constraints[0].event_types = event_types;
constraints[0].constraint_expr = CORBA::string_dup(
"");
filter->add_constraints(constraints);
pps->add_filter(filter.in());
std::cout << "Attached a filter to ProxyPushSupplier" << std::endl;
std::cout << "The filter's event_types[0].domain_name=" << event_types[0].domain_name << std::endl;
std::cout << "The filter's event_types[0].type_name=" << event_types[0].type_name << std::endl;
std::cout << "The filter's event_types[1].domain_name=" << event_types[1].domain_name << std::endl;
std::cout << "The filter's event_types[1].type_name=" << event_types[1].type_name << std::endl;
//Connecting a Supplier to a Proxy Consumer
try
{
pps->connect_structured_push_consumer(spc.in());
}
catch (CosEventChannelAdmin::AlreadyConnected ac)
{
std::cerr << "CosEventChannelAdmin::AlreadyConnected" << std::endl;
//.........这里部分代码省略.........
示例3: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
Consumer_Client client;
int status = client.init (argc, argv);
ACE_ASSERT(status == 0);
ACE_UNUSED_ARG(status);
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 ());
if (filter)
{
CosNotifyFilter::FilterFactory_var ffact =
ec->default_filter_factory ();
CosNotifyFilter::Filter_var filter =
ffact->create_filter ("TCL");
ACE_ASSERT(! CORBA::is_nil(filter.in()));
CosNotifyFilter::ConstraintExpSeq constraint_list (1);
constraint_list.length(1);
constraint_list[0].event_types.length (0);
constraint_list[0].constraint_expr = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (constraintString));
filter->add_constraints (constraint_list);
admin->add_filter(filter.in());
}
ACE_ASSERT (!CORBA::is_nil (admin.in ()));
create_consumers(admin.in (), &client);
// Tell the supplier to go
sig->go ();
client.ORB_run( );
ACE_DEBUG((LM_DEBUG, "Consumer done.\n"));
sig->done ();
return 0;
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("Error: Consumer exception: ");
}
return 1;
}
示例4: 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 << "Get event_channel now" << std::endl;
CosNotifyChannelAdmin::EventChannel_var ec = get_event_channel(orb.in());
//Attaching a filter to pps
CosNotifyFilter::FilterFactory_var dff =
ec->default_filter_factory();
ACE_ASSERT(!CORBA::is_nil(dff.in()));
std::cout << "Test CosNotifyFilter::Filter::match_structured" << std::endl;
//Constructing a test event
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 << "Constructing a test event" << std::endl;
std::cout << "\tIts header.fixed_header.event_type.domain_name="
<< event.header.fixed_header.event_type.domain_name
<< std::endl;
std::cout << "\tIts header.fixed_header.event_type.type_name="
<< event.header.fixed_header.event_type.type_name
<< std::endl;
CosNotifyFilter::Filter_var filter = dff->create_filter("EXTENDED_TCL");
update_constraints (filter, "DomainA", "TypeA", "DomainB", "TypeB");
bool expected_result = false;
match_structure_test (filter, event, expected_result);
update_constraints (filter, "*", "%ALL", "DomainB", "TypeB");
expected_result = true;
match_structure_test (filter, event, expected_result);
update_constraints (filter, "Test_domain", "%ALL", "DomainB", "TypeB");
expected_result = true;
match_structure_test (filter, event, expected_result);
update_constraints (filter, "*", "Test_type_name", "DomainB", "TypeB");
expected_result = true;
match_structure_test (filter, event, expected_result);
update_constraints (filter, "*", "*", "*", "*");
expected_result = true;
match_structure_test (filter, event, expected_result);
orb->shutdown();
}
catch(...)
{
std::cerr << "Filter: Some exceptions was caught!" << std::endl;
exit(1);
}
return 0;
}
示例5: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
Consumer_Client client;
int status = client.init (argc, argv);
if (status != 0)
{
ACE_ERROR((LM_ERROR, "Error: Unable to init consumer.\n"));
return 1;
}
CosNotifyChannelAdmin::EventChannel_var ec =
client.create_event_channel ("Struct_Multi_Filter", 1);
CosNotifyChannelAdmin::AdminID adminid = 0;
CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin =
ec->new_for_consumers ((consumerFilter == OrOp
? CosNotifyChannelAdmin::OR_OP : CosNotifyChannelAdmin::AND_OP),
adminid);
ACE_ASSERT(! CORBA::is_nil (consumer_admin.in ()));
if (consumerFilter != None)
{
CosNotifyFilter::FilterFactory_var ffact =
ec->default_filter_factory ();
CosNotifyFilter::Filter_var filter =
ffact->create_filter (GRAMMAR);
if (CORBA::is_nil (filter.in ()))
{
ACE_ERROR ((LM_ERROR,
" (%P|%t) Consumer unable to initialize filter.\n"));
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 ("type != 1");
filter->add_constraints (constraint_list);
consumer_admin->add_filter (filter.in ());
}
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 ()));
create_consumer (consumer_admin.in (), ec.in (), &client);
ACE_DEBUG((LM_DEBUG, "\nConsumer waiting for events...\n"));
sig->go ();
client.ORB_run( );
ACE_DEBUG((LM_DEBUG, "\nConsumer done.\n"));
sig->done();
return 0;
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception ("\nError: Consumer:");
}
return 1;
}
示例6: 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());
//.........这里部分代码省略.........