当前位置: 首页>>代码示例>>C++>>正文


C++ DomainParticipant_var::ignore_publication方法代码示例

本文整理汇总了C++中DomainParticipant_var::ignore_publication方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipant_var::ignore_publication方法的具体用法?C++ DomainParticipant_var::ignore_publication怎么用?C++ DomainParticipant_var::ignore_publication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomainParticipant_var的用法示例。


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

示例1: run_test


//.........这里部分代码省略.........
  if (ret != RETCODE_OK) {
    ACE_DEBUG((LM_ERROR, "ERROR: %P could not read TestMsg: %d\n", ret));
    return false;
  }

  bool ok = false;
  for (CORBA::ULong i = 0; i < data.length(); ++i) {
    if (infos[i].valid_data) {
      ok = true;
      ACE_DEBUG((LM_DEBUG, "%P Read data sample: %d\n", data[i].value));
    }
  }

  if (!ok) {
    ACE_DEBUG((LM_ERROR, "ERROR: %P no valid data from TestMsg data reader\n"));
  }

  // Change dp qos
  {
    DomainParticipantQos dp_qos;
    dp_pub->get_qos(dp_qos);
    set_qos(dp_qos.user_data.value, TestConfig::PARTICIPANT_USER_DATA2());
    dp_pub->set_qos(dp_qos);
  }
  // Change dw qos
  {
    DataWriterQos dw_qos;
    dw->get_qos(dw_qos);
    set_qos(dw_qos.user_data.value, TestConfig::DATA_WRITER_USER_DATA2());
    dw->set_qos(dw_qos);
  }
  // Change dr qos
  {
    DataReaderQos dr_qos;
    dr->get_qos(dr_qos);
    set_qos(dr_qos.user_data.value, TestConfig::DATA_READER_USER_DATA2());
    dr->set_qos(dr_qos);
  }
  // Wait for propagation
  ACE_OS::sleep(3);
  if (!read_participant_bit(bit_sub, dp_sub, pub_repo_id, TestConfig::PARTICIPANT_USER_DATA2())) {
    return false;
  }
  if (!read_publication_bit(bit_sub, dp_sub, pub_repo_id, ig_ih, TestConfig::DATA_WRITER_USER_DATA2(), TestConfig::TOPIC_DATA(), 1, 1)) {
    return false;
  }
  if (!read_subscription_bit(dp_pub->get_builtin_subscriber(), dp_pub, sub_repo_id, ig_ih, TestConfig::DATA_READER_USER_DATA2(), TestConfig::TOPIC_DATA())) {
    return false;
  }

  // Set dw topic qos
  Topic_var topic = dw->get_topic();
  TopicQos topic_qos;
  topic->get_qos(topic_qos);
  set_qos(topic_qos.topic_data.value, TestConfig::TOPIC_DATA2());
  topic->set_qos(topic_qos);

  // Set dr topic qos
  TopicDescription_var topic_desc = dr->get_topicdescription();
  topic = Topic::_narrow(topic_desc);
  topic->get_qos(topic_qos);
  set_qos(topic_qos.topic_data.value, TestConfig::TOPIC_DATA2());
  topic->set_qos(topic_qos);

  // Wait for propagation
  ACE_OS::sleep(3);
  if (!read_publication_bit(bit_sub, dp_sub, pub_repo_id, ig_ih, TestConfig::DATA_WRITER_USER_DATA2(), TestConfig::TOPIC_DATA2(), 1, 1)) {
    return false;
  }
  if (!read_subscription_bit(dp_pub->get_builtin_subscriber(), dp_pub, sub_repo_id, ig_ih, TestConfig::DATA_READER_USER_DATA2(), TestConfig::TOPIC_DATA2())) {
    return false;
  }

  // Test ignore
  dp_sub->ignore_publication(pub_ih);
  if (!read_publication_bit(bit_sub, dp_sub, pub_repo_id, pub_ih, TestConfig::DATA_WRITER_USER_DATA2(), TestConfig::TOPIC_DATA2(), 0, 0)) {
    ACE_ERROR_RETURN((LM_ERROR,
                     ACE_TEXT("ERROR: %P Could not ignore publication\n")), false);
  }

  dp_pub->ignore_subscription(sub_ih);
  if (!read_subscription_bit(dp_pub->get_builtin_subscriber(), dp_pub, sub_repo_id, sub_ih, TestConfig::DATA_READER_USER_DATA2(), TestConfig::TOPIC_DATA2(), true)) {
    ACE_ERROR_RETURN((LM_ERROR,
                     ACE_TEXT("ERROR: %P Could not ignore subscription\n")), false);
  }

  dp_sub->ignore_participant(dp_pub_ih);
  InstanceHandleSeq handles;
  dp_sub->get_discovered_participants(handles);
  // Check that the handle is no longer in the sequence.
  for (CORBA::ULong i = 0; i < handles.length (); ++i) {
    if (handles[i] == dp_pub_ih) {
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("ERROR: %P Could not ignore participant\n")), false);

    }
  }

  return ok;
}
开发者ID:yanbodiaoweng,项目名称:DDS,代码行数:101,代码来源:RtpsDiscoveryTest.cpp

示例2: ignore

int ignore ()
{
#if !defined (DDS_HAS_MINIMUM_BIT)
  switch (ignore_kind)
  {
  case IGNORE_PARTICIPANT:
    {
      // Normally a client application would use some Qos like
      // the USER_DATA to find the Built-In Topic InstanceHandle_t
      // value for an entity (e.g. a DomainParticipant) but this
      // test knows everything and can use the discovery RepoID.
      ::OpenDDS::DCPS::RepoId part_id = participant_servant->get_id ();
      //SHH one of these should be the subscriber participant and the other should be the publisher participant.
      ::OpenDDS::DCPS::RepoId ignore_id = participant_servant->get_id ();

      std::stringstream participantBuffer;
      participantBuffer << part_id;
      std::stringstream ignoreBuffer;
      ignoreBuffer << ignore_id;
      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) IGNORE_PARTICIPANT,  participant %C ignore participant %C .\n"),
                 participantBuffer.str().c_str(), ignoreBuffer.str().c_str()));

      InstanceHandle_t handle = participant_servant->get_handle(ignore_id);

      ACE_DEBUG((LM_DEBUG,
        ACE_TEXT("(%P|%t) IGNORE_PARTICIPANT, ignored participant %C has handle 0x%x.\n"),
        ignoreBuffer.str().c_str(),
        handle
      ));

      DDS::ReturnCode_t ret = participant->ignore_participant(handle);

      if (ret != ::DDS::RETCODE_OK)
      {
        ACE_ERROR ((LM_ERROR,
                    ACE_TEXT("(%P|%t) IGNORE_PARTICIPANT, ")
                    ACE_TEXT(" participant %C ignore participant %C returned error %d\n"),
                    participantBuffer.str().c_str(), ignoreBuffer.str().c_str(), ret));
        return -1;
      }
    }
    break;

  case IGNORE_TOPIC:
    {
      ::OpenDDS::DCPS::RepoId part_id = participant_servant->get_id ();
      ::OpenDDS::DCPS::RepoId ignore_id = topic_servant->get_id ();

      std::stringstream participantBuffer;
      participantBuffer << part_id;
      std::stringstream ignoreBuffer;
      ignoreBuffer << ignore_id;
      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) IGNORE_TOPIC, participant %C ignore topic %C .\n"),
                 participantBuffer.str().c_str(), ignoreBuffer.str().c_str()));

      InstanceHandle_t handle = participant_servant->get_handle(ignore_id);
      ACE_DEBUG((LM_DEBUG,
        ACE_TEXT("(%P|%t) IGNORE_TOPIC,  ignored topic %C has handle 0x%x.\n"),
        ignoreBuffer.str().c_str(),
        handle
      ));

      DDS::ReturnCode_t ret = participant->ignore_topic(handle);

      if (ret != ::DDS::RETCODE_OK)
      {
        ACE_ERROR ((LM_ERROR,
                    ACE_TEXT("(%P|%t) IGNORE_TOPIC, ")
                    ACE_TEXT(" ignore_topic 0x%x return error %d\n"),
                    handle, ret));
        return -1;
      }
    }
    break;
  case IGNORE_PUBLICATION:
    {
      ::OpenDDS::DCPS::RepoId part_id = participant_servant->get_id ();
      ::OpenDDS::DCPS::RepoId ignore_id = datawriter_servant->get_publication_id ();

      std::stringstream participantBuffer;
      participantBuffer << part_id;
      std::stringstream ignoreBuffer;
      ignoreBuffer << ignore_id;
      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) IGNORE_PUBLICATION, participant %C ignore publication %C .\n"),
                 participantBuffer.str().c_str(), ignoreBuffer.str().c_str()));

      InstanceHandle_t handle = participant_servant->get_handle(ignore_id);
      ACE_DEBUG((LM_DEBUG,
        ACE_TEXT("(%P|%t) IGNORE_PUBLICATION,  ignored topic %C has handle 0x%x.\n"),
        ignoreBuffer.str().c_str(),
        handle
      ));

      DDS::ReturnCode_t ret = participant->ignore_publication(handle);

      if (ret != ::DDS::RETCODE_OK)
      {
//.........这里部分代码省略.........
开发者ID:CapXilinx,项目名称:OpenDDS,代码行数:101,代码来源:common.cpp

示例3: ignore


//.........这里部分代码省略.........
      ::TAO::DCPS::RepoId part_id = participant_servant->get_id ();
      ::TAO::DCPS::RepoId ignore_id = datawriter_servant->get_publication_id ();

      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) IGNORE_PUBLICATION, participant %d ignore publication %d .\n"),
                 part_id, ignore_id));

      ::DDS::InstanceHandleSeq handles;
      ::TAO::DCPS::ReaderIdSeq ignore_ids;
      ignore_ids.length (1);
      ignore_ids[0] = ignore_id;

      ::TAO::DCPS::BIT_Helper_2 <
                    ::DDS::PublicationBuiltinTopicDataDataReader,
                    ::DDS::PublicationBuiltinTopicDataDataReader_var,
                    ::DDS::PublicationBuiltinTopicDataSeq,
                    ::TAO::DCPS::ReaderIdSeq > hh;

      ::DDS::ReturnCode_t ret
        = hh.repo_ids_to_instance_handles(participant_servant,
          ::TAO::DCPS::BUILT_IN_PUBLICATION_TOPIC,
          ignore_ids,
          handles);

      if (ret != ::DDS::RETCODE_OK)
      {
        ACE_ERROR ((LM_ERROR,
          ACE_TEXT("(%P|%t) IGNORE_PUBLICATION, ")
          ACE_TEXT(" repo_ids_to_instance_handles returned error %d\n"),
          ret));
        return -1;
      }

      ret = participant->ignore_publication (handles[0]);

      if (ret != ::DDS::RETCODE_OK)
      {
        ACE_ERROR ((LM_ERROR,
                    ACE_TEXT("(%P|%t) IGNORE_PUBLICATION, ")
                    ACE_TEXT(" ignore_publication %d return error %d\n"),
                    handles[0], ret));
        return -1;
      }
    }
    break;
  case IGNORE_SUBSCRIPTION:
    {
      ::TAO::DCPS::RepoId part_id = participant_servant->get_id ();
      ::TAO::DCPS::RepoId ignore_id = datareader_servant->get_subscription_id ();

      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) IGNORE_SUBSCRIPTION, participant %d ignore subscription %d .\n"),
                 part_id, ignore_id));

      ::DDS::InstanceHandleSeq handles;
      ::TAO::DCPS::ReaderIdSeq ignore_ids;
      ignore_ids.length (1);
      ignore_ids[0] = ignore_id;

      ::TAO::DCPS::BIT_Helper_2 < ::DDS::SubscriptionBuiltinTopicDataDataReader,
                    ::DDS::SubscriptionBuiltinTopicDataDataReader_var,
                    ::DDS::SubscriptionBuiltinTopicDataSeq,
                    ::TAO::DCPS::ReaderIdSeq > hh;

      ::DDS::ReturnCode_t ret
        = hh.repo_ids_to_instance_handles(participant_servant,
开发者ID:svn2github,项目名称:OpenDDS,代码行数:67,代码来源:common.cpp


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