• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cosnotifyfilter::Filter_var类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cosnotifyfilter::Filter_var的典型用法代码示例。如果您正苦于以下问题:C++ Filter_var类的具体用法?C++ Filter_var怎么用?C++ Filter_var使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Filter_var类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: constraint_list

CosNotifyFilter::FilterID
ExtendedFilter::add_filter (CosNotifyFilter::FilterAdmin_ptr filter_admin)
{
  // setup a filter at the filter admin
  CosNotifyFilter::Filter_var filter =
    this->ffact_->create_filter ("ETCL");

  ACE_ASSERT (!CORBA::is_nil (filter.in ()));

  const char* test_filter_string = "A > B";

  CosNotifyFilter::ConstraintExpSeq constraint_list (1);
  constraint_list.length (1);

  constraint_list[0].event_types.length (0);
  constraint_list[0].constraint_expr = CORBA::string_dup (test_filter_string);

  filter->add_constraints (constraint_list);

  CosNotifyFilter::FilterID id = filter_admin->add_filter (filter.in ());

  // Print the ID
  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Added Filter %d\n", id));

  return id;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:27,代码来源:ExtendedFilter.cpp


示例2: setAntennaName

void Consumer::setAntennaName(std::string antennaName) {
    //If the antenna name is already set, do nothing
    if (this->antennaName.compare("") != 0)
        return;
    this->antennaName = antennaName;
    if (antennaName.compare("") != 0) {
        std::cout << "Adding filter" << std::endl;
        CosNotifyFilter::FilterFactory_var filter_factory =
                notifyChannel_m->default_filter_factory();
        CosNotifyFilter::Filter_var filter = filter_factory->create_filter(
                "ETCL");
        if (CORBA::is_nil(filter)) {
            ACS_SHORT_LOG(
                    (LM_ERROR,"Consumer::createConsumer failed for the '%s' channel due the filter cannot be created!", channelName_mp));
        }
        CosNotifyFilter::ConstraintExpSeq constraint_list;
        constraint_list.length(1);
        constraint_list[0].event_types.length(0);
        std::string filter_expr = "$antenna_name == '" + antennaName + "'";
        std::cout << filter_expr << std::endl;
        constraint_list[0].constraint_expr = CORBA::string_dup(
                filter_expr.c_str());
        filter->add_constraints(constraint_list);
        proxySupplier_m->add_filter(filter.in());
    }
}
开发者ID:jbarriosc,项目名称:ACS,代码行数:26,代码来源:acsncConsumerImpl.cpp


示例3: constraint_list

static CosNotifyChannelAdmin::ConsumerAdmin_ptr
create_consumeradmin (CosNotifyChannelAdmin::EventChannel_ptr ec)
{
  CosNotifyChannelAdmin::AdminID adminid = 0;
  CosNotifyChannelAdmin::ConsumerAdmin_var admin =
    ec->new_for_consumers (CosNotifyChannelAdmin::AND_OP,
                           adminid);


  if (filter)
    {
      ACE_DEBUG((LM_DEBUG, "\nConsumer filter enabled.\n"));

      CosNotifyFilter::FilterFactory_var ffact =
          ec->default_filter_factory ();

      CosNotifyFilter::Filter_var filter =
          ffact->create_filter (GRAMMAR);

      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 == 'even'");

      filter->add_constraints (constraint_list);

      admin->add_filter (filter.in ());
    }

  return CosNotifyChannelAdmin::ConsumerAdmin::_duplicate (admin.in ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:33,代码来源:Sequence_Consumer.cpp


示例4:

void
TAO_Notify_Tests_Filter_Command::handle_destroy_filter (void)
{
  CosNotifyFilter::Filter_var filter;

  LOOKUP_MANAGER->resolve (filter, this->name_.c_str ());

  filter->destroy ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:9,代码来源:Filter_Command.cpp


示例5:

::CosNotifyFilter::Filter_ptr TAO::FT_FaultNotifier_i::create_subscription_filter (
    const char * constraint_grammar
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::create_subscription_filter);
    ACE_UNUSED_ARG (constraint_grammar); //@@todo

    CosNotifyFilter::Filter_var filter = this->filter_factory_->create_filter ("ETCL");
    METHOD_RETURN(TAO::FT_FaultNotifier_i::create_subscription_filter)
    filter._retn ();
}
开发者ID:akostrikov,项目名称:ATCD,代码行数:11,代码来源:FT_Notifier_i.cpp


示例6: init

/**
 * register this object
 */
int StubBatchConsumer::init (CORBA::ORB_ptr orb, ::FT::FaultNotifier_var & notifier)
{
  int result = 0;
  this->orb_ = CORBA::ORB::_duplicate (orb);
  this->notifier_ = notifier;
  this->identity_ = "StubBatchConsumer";


  // Use the ROOT POA for now
  CORBA::Object_var poa_object =
    this->orb_->resolve_initial_references (TAO_OBJID_ROOTPOA);

  if (CORBA::is_nil (poa_object.in ()))
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT (" (%P|%t) Unable to initialize the POA.\n")),
                      -1);

  // Get the POA .
  this->poa_ = PortableServer::POA::_narrow (poa_object.in ());


  if (CORBA::is_nil(this->poa_.in ()))
  {
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT (" (%P|%t) Unable to narrow the POA.\n")),
                      -1);
  }

  PortableServer::POAManager_var poa_manager =
    this->poa_->the_POAManager ();

  poa_manager->activate ();

  // Register with the POA.

  this->object_id_ = this->poa_->activate_object (this);

  // find my identity as an object

  CORBA::Object_var this_obj =
    this->poa_->id_to_reference (object_id_.in ());

  CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_nil();

  this->consumer_id_ = notifier->connect_sequence_fault_consumer(
    CosNotifyComm::SequencePushConsumer::_narrow(this_obj.in ()),
    filter.in ());

  return result;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:53,代码来源:StubBatchConsumer.cpp


示例7: constraint_list

void
TAO_Notify_Tests_Filter_Command::handle_add_constraint (void)
{
  CosNotifyFilter::Filter_var filter;

  LOOKUP_MANAGER->resolve (filter , this->name_.c_str ());

  CosNotifyFilter::ConstraintExpSeq constraint_list (1);
  constraint_list.length (1);

  constraint_list[0].event_types.length (0);
  constraint_list[0].constraint_expr = CORBA::string_dup (this->constraint_.c_str ());

  ACE_DEBUG ((LM_DEBUG, "Adding constraint %s\n", this->constraint_.c_str ()));
  filter->add_constraints (constraint_list);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:16,代码来源:Filter_Command.cpp


示例8: match_structure_test

void match_structure_test (const CosNotifyFilter::Filter_var& filter,
                           const CosNotification::StructuredEvent& event,
                           bool & expected_result)
{
  bool bResult = false;
  try{
    bResult = filter->match_structured(event);
  }
  catch(CosNotifyFilter::UnsupportedFilterableData)
  {
    std::cerr << "UnsupportedFilterableData!" << std::endl;
  }
  catch (CORBA::SystemException& se )
  {
    std::cerr << "System exception occurred during match_structured: "
      << se << std::endl;
    exit(1);
  }

  std::cout << "The result is:" << (bResult?"Match":"Unmatch") << std::endl;

  if (bResult != expected_result)
  {
    // The result should be unmatched as it's filtered with event type.
    std::cerr << "filter test failed." << std::endl;
    exit(1);
  }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:28,代码来源:filter.cpp


示例9: constraint_list

void
Notify_Push_Supplier::_connect (
                CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin,
                CosNotifyChannelAdmin::EventChannel_ptr notify_channel,
                bool useFilter)
{
  CosNotifyComm::StructuredPushSupplier_var objref =
    this->_this ();

  CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer =
    supplier_admin->obtain_notification_push_consumer (
      CosNotifyChannelAdmin::STRUCTURED_EVENT,
      proxy_id_);

  if (useFilter)
    {
      CosNotifyFilter::FilterFactory_var ffact =
        notify_channel->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 ("group != 0");

      filter->add_constraints (constraint_list);

      proxyconsumer->add_filter (filter.in ());
    }

  this->proxy_ =
    CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (
      proxyconsumer.in ());

  this->proxy_->connect_structured_push_supplier (objref.in ());

  // give ownership to POA
  this->_remove_ref ();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:44,代码来源:Notify_Push_Supplier.cpp


示例10: INTERNAL

TAO_Notify::Topology_Object*
TAO_Notify_FilterAdmin::load_child (const ACE_CString &type, CORBA::Long id,
  const TAO_Notify::NVPList& attrs)
{
  if (type == "filter")
  {
   TAO_Notify_Object::ID mapid = 0;
   attrs.load("MapId", mapid);

   TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant ();
   CosNotifyFilter::Filter_var filter = factory->get_filter (mapid);

    if (! CORBA::is_nil(filter.in()))
    {
      this->filter_ids_.set_last_used(id);
      if (this->filter_list_.bind (id, filter) != 0)
        throw CORBA::INTERNAL ();
    }
  }
  return this;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:21,代码来源:FilterAdmin.cpp


示例11: update_constraints

void update_constraints (const CosNotifyFilter::Filter_var& filter,
                         const char* domain1, const char* type1,
                         const char* domain2, const char* type2)
{
    filter->remove_all_constraints ();

    CosNotification::EventTypeSeq event_types(2);
    event_types.length(2);

    event_types[0].domain_name = CORBA::string_dup(domain1);
    event_types[0].type_name = CORBA::string_dup(type1);

    event_types[1].domain_name = CORBA::string_dup(domain2);
    event_types[1].type_name = CORBA::string_dup(type2);

    CosNotifyFilter::ConstraintExpSeq constraints(1);
    constraints.length(1);

    constraints[0].event_types = event_types;
    constraints[0].constraint_expr = CORBA::string_dup("");

    CosNotifyFilter::ConstraintInfoSeq_var cons_info
      = filter->add_constraints(constraints);

    std::cout << "Constructing a filter..." << std::endl;

    for (CORBA::ULong i = 0; i < event_types.length(); ++i)
    {
      std::cout << "\tevent_types[" << i << "].domain_name="
        << event_types[i].domain_name
        << std::endl;
      std::cout << "\tevent_types[" << i << "].type_name="
        << event_types[i].type_name
        << std::endl;
    }

    std::cout << "\tIts constraint ="
      << constraints[0].constraint_expr.in ()
      << std::endl;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:40,代码来源:filter.cpp


示例12:

CosNotifyFilter::Filter_ptr
TAO_Notify_ETCL_FilterFactory::find_filter (const TAO_Notify_Object::ID& id)
{
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
                    ace_mon,
                    this->mtx_,
                    CosNotifyFilter::Filter::_nil ());

  TAO_Notify_ETCL_Filter* filter = 0;
  if (filters_.find (id, filter) == -1)
    return CosNotifyFilter::Filter::_nil ();
  else
  {
    CORBA::Object_var obj =
      this->filter_poa_->servant_to_reference (filter);

    CosNotifyFilter::Filter_var filter
      = CosNotifyFilter::Filter::_narrow (obj.in ());

    return filter._retn ();
  }
}
开发者ID:binary42,项目名称:OCI,代码行数:22,代码来源:ETCL_FilterFactory.cpp


示例13: constraint_list

static CosNotifyFilter::Filter_ptr
create_proxyFilter (CosNotifyChannelAdmin::EventChannel_ptr ec)
{
  CosNotifyFilter::FilterFactory_var ffact =
    ec->default_filter_factory ();

  CosNotifyFilter::Filter_var filter =
    ffact->create_filter ("EXTENDED_TCL");

  if(!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 ("$.domain_name == 'domain1'");

    filter->add_constraints (constraint_list);
    }
  return filter._retn();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:23,代码来源:Consumer.cpp


示例14: 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;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:66,代码来源:Sequence_Consumer.cpp


示例15: 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;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:80,代码来源:Structured_Consumer.cpp


示例16: addFilter

//-----------------------------------------------------------------------------
int Consumer::addFilter(const char* type_name,
		    const char* filterString)
{
    ACS_TRACE("Consumer::addFilter");
    
    try
	{
	//Create a temporary filter factory
	CosNotifyFilter::FilterFactory_var filterFactory = notifyChannel_m->default_filter_factory();
	if(CORBA::is_nil(filterFactory.in()) == true)
	    {
	    CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter");
	    throw err.getCORBAProblemEx();
	    }
	
	//Create a filter
	CosNotifyFilter::Filter_var filter = 0;
	filter = filterFactory->create_filter(getFilterLanguage());
	if(filter.in() == 0)
	    {
	    CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter");
	    throw err.getCORBAProblemEx();
	    }
	
	//Create the constraint expression sequence
	CosNotifyFilter::ConstraintExpSeq cexp(1);
	cexp.length(1);
	cexp[0].event_types.length(1);
	cexp[0].event_types[0].domain_name = getChannelDomain();
	cexp[0].event_types[0].type_name   = CORBA::string_dup(type_name);
	cexp[0].constraint_expr            = CORBA::string_dup(filterString);
	
	try
	    {
	    filter->add_constraints(cexp);
	    }
	catch(CosNotifyFilter::InvalidConstraint e)
	    {
	    if (filter.in() != 0)
		{
		filter->destroy();
		filter = 0;
		}
	    
	    ACS_SHORT_LOG((LM_ERROR,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter!",
			   channelName_mp, type_name, filterString));
	    CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter");
	    throw err.getCORBAProblemEx();
	    }
	
	return proxySupplier_m->add_filter(filter._retn());
	}
    catch(CORBAProblemEx)
	{
	ACS_SHORT_LOG((LM_TRACE,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter with a nil pointer!",
		       channelName_mp, type_name, filterString));
	throw;
	}
    catch(...)
	{
	ACS_SHORT_LOG((LM_ERROR,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter!",
		       channelName_mp, type_name, filterString));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter");
	throw err.getCORBAProblemEx();
	}
}
开发者ID:jbarriosc,项目名称:ACS,代码行数:67,代码来源:acsncConsumerImpl.cpp


示例17: defined

void
ExtendedFilter::run_filter_test (CosNotifyFilter::FilterAdmin_ptr filter_admin)
{
  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Narrowing CosNotifyFilterExt::FilterFactory\n"));

  CosNotifyFilterExt::FilterFactory_var extffact =
      CosNotifyFilterExt::FilterFactory::_narrow(ffact_.in());
  ACE_ASSERT (!CORBA::is_nil (extffact.in ()));

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Getting  ec2 FilterFactory\n"));
   CosNotifyFilter::FilterFactory_var  ffact2 = ec2_->default_filter_factory ();

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Narrowing CosNotifyFilterExt::FilterFactory\n"));
  CosNotifyFilterExt::FilterFactory_var extffact2 =
      CosNotifyFilterExt::FilterFactory::_narrow(ffact2.in());
  ACE_ASSERT (!CORBA::is_nil (extffact2.in ()));

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Adding a filter\n"));

  CosNotifyFilter::FilterID id_1 = this->add_filter (filter_admin);

  this->verify_filter_count (filter_admin, 1);

  if (TAO_debug_level)
    {
      ACE_DEBUG ((LM_DEBUG, "Calling print_filters\n"));
      this->print_filters (filter_admin);
    }

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling CosNotifyFilterExt::FilterFactory::get_filter\n"));

  CosNotifyFilter::Filter_var filter = extffact->get_filter (id_1);
  ACE_ASSERT (!CORBA::is_nil (filter.in ()));

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling CosNotifyFilterExt::FilterFactory::get_filterid\n"));

  CosNotifyFilter::FilterID id_dup = extffact->get_filterid (filter.in());
  ACE_ASSERT (id_dup == id_1);
#if defined (ACE_NDEBUG)
  ACE_UNUSED_ARG (id_dup );
#endif

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling CosNotifyFilterExt::FilterFactory::get_filterid of non existent filter\n"));

  bool id_lookup_failed = false;
  try {
    CosNotifyFilter::FilterID id_ne = extffact2->get_filterid (filter.in());
    ACE_UNUSED_ARG (id_ne );
  } catch (const CORBA::INTERNAL& ) {
    id_lookup_failed = true;
    }
  ACE_ASSERT (id_lookup_failed );
#if defined (ACE_NDEBUG)
  ACE_UNUSED_ARG (id_lookup_failed );
#endif

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling remove_filter\n"));

  // remove the filter.
  filter_admin->remove_filter (id_1);

  this->verify_filter_count (filter_admin, 0);

  if (TAO_debug_level)
    {
      ACE_DEBUG ((LM_DEBUG, "Calling print_filters\n"));
      this->print_filters (filter_admin);
    }

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling remove_all_filters\n"));

  filter_admin->remove_all_filters ();

  if (TAO_debug_level)
    {
      ACE_DEBUG ((LM_DEBUG, "Calling print_filters\n"));
      this->print_filters (filter_admin);
    }

  // Make sure all filters are removed -
  this->verify_filter_count (filter_admin, 0);

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling CosNotifyFilterExt::FilterFactory::remove_filter\n"));

  extffact->remove_filter(filter.in());
  filter = CosNotifyFilter::Filter::_nil ();

  if (TAO_debug_level)
    ACE_DEBUG ((LM_DEBUG, "Calling CosNotifyFilterExt::FilterFactory::get_filter of removed filter\n"));

//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:ExtendedFilter.cpp


示例18:

void
FilterClient::verify_filter (CosNotifyFilter::FilterAdmin_var& admin,
                             const char* constraint_expr,
                             const char* mod_constraint_expr)
{
  ACE_UNUSED_ARG (constraint_expr);
  // only used to validate assert, which is
  // compiled out for nondebug builds.
  const CosNotifyFilter::FilterIDSeq_var ids
    = admin->get_all_filters ();

  ACE_ASSERT (ids->length () == 1);

  CosNotifyFilter::Filter_var filter
    = admin->get_filter (ids[0]);

  ACE_ASSERT (! CORBA::is_nil (filter.in ()));

  CosNotifyFilter::ConstraintInfoSeq_var infos
    = filter->get_all_constraints();

  ACE_ASSERT (infos->length () == 2);

  u_int index = 0;

  for (index = 0; index < infos->length (); ++ index)
  {
    CosNotifyFilter::ConstraintID id = infos[index].constraint_id;
    ACE_UNUSED_ARG (id);
    // only used to validate assert, which is
    // compiled out for nondebug builds.
    ACE_ASSERT (id != 0);
    ACE_ASSERT (ACE_OS::strcmp (infos[index].constraint_expression.constraint_expr.in (), constraint_expr) == 0);

    CosNotification::EventTypeSeq& events = infos[index].constraint_expression.event_types;
    ACE_UNUSED_ARG (events);
    // only used to validate assert, which is
    // compiled out for nondebug builds.
    ACE_ASSERT (events.length () == 1);

    ACE_ASSERT (ACE_OS::strcmp (events[0].domain_name.in (), DOMAIN_NAME) == 0);
    ACE_ASSERT (ACE_OS::strcmp (events[0].type_name.in (), TYPE_NAME) == 0);
  }

  if (modify_constraint_)
  {
    CosNotifyFilter::ConstraintIDSeq_var ids = new CosNotifyFilter::ConstraintIDSeq (2);
    ids->length (2);
    for (index = 0; index < infos->length (); ++ index)
    {
      ids[index] = infos[index].constraint_id;
      ACE_DEBUG ((LM_DEBUG,
      ACE_TEXT ("(%P|%t)modify constraint %d \n"), ids[index]));

      infos[index].constraint_expression.constraint_expr
        = CORBA::string_dup (mod_constraint_expr);
    }

    filter->modify_constraints (ids.in (), infos.in());
  }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:61,代码来源:Filter.cpp


示例19: 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;
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:consumer.cpp


示例20: 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;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:68,代码来源:Consumer.cpp



注:本文中的cosnotifyfilter::Filter_var类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ costmap_2d::Costmap2D类代码示例发布时间:2022-05-31
下一篇:
C++ cosnotifychanneladmin::SupplierAdmin_var类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap