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


C++ Publisher_var::copy_from_topic_qos方法代码示例

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


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

示例1:

DDS::DataWriter_var
OpenDDS::Model::Entities::writer(
  const OPENDDS_STRING& name,
  const OPENDDS_STRING& transportConfig)
{
  StringToDataWriterMap::const_iterator which
    = this->writerByString_.find( name);
  if( which != this->writerByString_.end()) {
    return DDS::DataWriter::_duplicate( which->second);
  }

  // See if there is a configuration profile for it.
  Config::WriterProfileMap::const_iterator where
    = this->config_.writerProfileMap().find( name);
  if( where == this->config_.writerProfileMap().end()) {
    ACE_ERROR((LM_ERROR,
      ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ")
      ACE_TEXT("unable to find profile to configure ")
      ACE_TEXT("writer: [%C].\n"),
      name.c_str()
    ));
    return 0;
  }
  WriterProfile* profile = where->second;

  // Find the containing Publisher.
  DDS::Publisher_var publisher = this->publisher(profile->publisher,
                                                 transportConfig);
  if( !publisher) {
    ACE_ERROR((LM_ERROR,
      ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ")
      ACE_TEXT("unable to find publisher: [%C] for writer [%C].\n"),
      profile->publisher.c_str(), name.c_str()
    ));
    return 0;
  }

  // We need the *name* of the participant in order to look up the Topic.
  // This should be Ok since we will only be configuring Writers that have
  // been successfully defined in a configuration file, implying that there
  // exists a defined [publisher] profile.
  Config::PublisherProfileMap::const_iterator location
    = this->config_.publisherProfileMap().find( profile->publisher);
  if( location == this->config_.publisherProfileMap().end()) {
    ACE_ERROR((LM_ERROR,
      ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ")
      ACE_TEXT("unable to find profile to configure ")
      ACE_TEXT("publisher: [%C] for writer [%C].\n"),
      profile->publisher.c_str(), name.c_str()
    ));
    return 0;
  }
  PublisherProfile* publisherProfile = location->second;

  // Find the Topic.
  DDS::Topic_var topic
    = this->topic( profile->topic,
                   publisherProfile->participant,
                   transportConfig);
  if( !topic) {
    ACE_ERROR((LM_ERROR,
      ACE_TEXT("(%P|%t) ERROR: Entities::writer() - ")
      ACE_TEXT("unable to find topic: [%C] for writer [%C] in participant [%C].\n"),
      profile->topic.c_str(), name.c_str(),
      publisherProfile->participant.c_str()
    ));
    return 0;
  }

  DDS::DataWriterQos writerQos;
  DDS::TopicQos      topicQos;
  topic->get_qos( topicQos);
  publisher->get_default_datawriter_qos( writerQos);
  publisher->copy_from_topic_qos( writerQos, topicQos);
  profile->copyToWriterQos( writerQos);

  if( OpenDDS::DCPS::DCPS_debug_level>1) {
    ACE_DEBUG((LM_DEBUG,
      ACE_TEXT("(%P|%t) Entities::writer() - ")
      ACE_TEXT("Creating writer [%C] in publisher [%C] in participant [%C] ")
      ACE_TEXT("with topic [%C].\n"),
      name.c_str(),
      profile->publisher.c_str(),
      publisherProfile->participant.c_str(),
      profile->topic.c_str()
    ));
  }
  this->writerByString_[ name]
    = this->delegate_.createWriter(
        publisher,
        topic,
        writerQos,
        OpenDDS::DCPS::DEFAULT_STATUS_MASK,
        transportConfig
      );

  return this->writerByString_[ name];
}
开发者ID:AndroidDev77,项目名称:OpenDDS,代码行数:98,代码来源:Entities.cpp


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