本文整理汇总了C++中dds::Subscriber_var::copy_from_topic_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscriber_var::copy_from_topic_qos方法的具体用法?C++ Subscriber_var::copy_from_topic_qos怎么用?C++ Subscriber_var::copy_from_topic_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Subscriber_var
的用法示例。
在下文中一共展示了Subscriber_var::copy_from_topic_qos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DDS::DataReader_var
OpenDDS::Model::Entities::reader(
const OPENDDS_STRING& name,
const OPENDDS_STRING& transportConfig)
{
StringToDataReaderMap::const_iterator which
= this->readerByString_.find( name);
if( which != this->readerByString_.end()) {
return DDS::DataReader::_duplicate( which->second);
}
// See if there is a configuration profile for it.
Config::ReaderProfileMap::const_iterator where
= this->config_.readerProfileMap().find( name);
if( where == this->config_.readerProfileMap().end()) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ")
ACE_TEXT("unable to find profile to configure ")
ACE_TEXT("reader: [%C].\n"),
name.c_str()
));
return 0;
}
ReaderProfile* profile = where->second;
// Find the containing Subscriber.
DDS::Subscriber_var subscriber = this->subscriber(profile->subscriber,
transportConfig);
if( !subscriber) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ")
ACE_TEXT("unable to find subscriber: [%C] for reader [%C].\n"),
profile->subscriber.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 Readers that have
// been successfully defined in a configuration file, implying that there
// exists a defined [subscriber] profile.
Config::SubscriberProfileMap::const_iterator location
= this->config_.subscriberProfileMap().find( profile->subscriber);
if( location == this->config_.subscriberProfileMap().end()) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ")
ACE_TEXT("unable to find profile to configure ")
ACE_TEXT("subscriber: [%C] for reader [%C].\n"),
profile->subscriber.c_str(), name.c_str()
));
return 0;
}
SubscriberProfile* subscriberProfile = location->second;
// Find the Topic.
DDS::Topic_var topic
= this->topic(profile->topic,
subscriberProfile->participant,
transportConfig);
if( !topic) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: Entities::reader() - ")
ACE_TEXT("unable to find topic: [%C] for reader [%C] in participant [%C].\n"),
profile->topic.c_str(), name.c_str(),
subscriberProfile->participant.c_str()
));
return 0;
}
DDS::DataReaderQos readerQos;
DDS::TopicQos topicQos;
topic->get_qos( topicQos);
subscriber->get_default_datareader_qos( readerQos);
subscriber->copy_from_topic_qos( readerQos, topicQos);
profile->copyToReaderQos( readerQos);
if( OpenDDS::DCPS::DCPS_debug_level>1) {
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) Entities::reader() - ")
ACE_TEXT("Creating reader [%C] in subscriber [%C] in participant [%C] ")
ACE_TEXT("with topic [%C].\n"),
name.c_str(),
profile->subscriber.c_str(),
subscriberProfile->participant.c_str(),
profile->topic.c_str()
));
}
this->readerByString_[ name]
= this->delegate_.createReader(
subscriber,
topic,
readerQos,
OpenDDS::DCPS::DEFAULT_STATUS_MASK,
transportConfig
);
return this->readerByString_[ name];
}