本文整理汇总了C++中dds::Topic_var::get_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ Topic_var::get_qos方法的具体用法?C++ Topic_var::get_qos怎么用?C++ Topic_var::get_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Topic_var
的用法示例。
在下文中一共展示了Topic_var::get_qos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DDS::DataReader*
OpenDDS::Model::Delegate::createSubscription(
unsigned int which,
DDS::Subscriber* subscriber,
DDS::TopicDescription* topic,
const DDS::DataReaderQos& readerQos,
DDS::StatusMask mask,
const OPENDDS_STRING& transportConfig,
bool copyQosFromTopic
)
{
if( !this->service_) {
return 0;
}
DDS::DataReaderQos dr_qos = readerQos;
if (copyQosFromTopic) {
// Per the DDS Spec, copy from related topic for CF topic,
// Error if copy from mulitopic
DDS::TopicQos topicQos = TheServiceParticipant->initial_TopicQos();
DDS::Topic* qosTopic;
if ((qosTopic = dynamic_cast<DDS::Topic*>(topic)) != NULL) {
qosTopic->get_qos(topicQos);
#ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC
} else {
DDS::ContentFilteredTopic* qosCfTopic =
dynamic_cast<DDS::ContentFilteredTopic*>(topic);
if (qosCfTopic != NULL) {
DDS::Topic_var related = qosCfTopic->get_related_topic();
related->get_qos(topicQos);
}
#endif
}
subscriber->copy_from_topic_qos(dr_qos, topicQos);
}
this->service_->copySubscriptionQos(which, dr_qos);
return this->createReader(
subscriber,
topic,
dr_qos,
mask,
transportConfig
);
}
示例2:
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];
}
示例3: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR** argv)
{
try {
OpenDDS::Model::Application application(argc, argv);
TopQos::DefaultTopQosType model(application, argc, argv);
using OpenDDS::Model::TopQos::Elements;
DDS::DataWriter_var writer = model.writer( Elements::DataWriters::writer);
// START OF EXISTING MESSENGER EXAMPLE CODE
data1::MessageDataWriter_var message_writer =
data1::MessageDataWriter::_narrow(writer.in());
DDS::Topic_var topic = message_writer->get_topic();
DDS::TopicQos topic_qos;
if (CORBA::is_nil(message_writer.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" _narrow failed!\n")),
-1);
}
if (topic->get_qos(topic_qos) != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos failed!\n")),
-1);
}
if (topic_qos.deadline.period.sec != 1) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong deadline!\n")),
-1);
}
if (topic_qos.deadline.period.nanosec != 25) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong deadline!\n")),
-1);
}
if (topic_qos.destination_order.kind !=
DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong destination order!\n")),
-1);
}
if (topic_qos.durability.kind != DDS::TRANSIENT_LOCAL_DURABILITY_QOS) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability !\n")),
-1);
}
if (topic_qos.durability_service.history_kind != DDS::KEEP_LAST_HISTORY_QOS) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability_service history_kind\n")),
-1);
}
if (topic_qos.durability_service.history_depth != 5) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability_service history_depth\n")),
-1);
}
if (topic_qos.durability_service.max_instances != 20) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability_service max_instances\n")),
-1);
}
if (topic_qos.durability_service.max_samples != 500) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability_service max_samples\n")),
-1);
}
if (topic_qos.durability_service.max_samples_per_instance != 100) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong durability_service max_samples_per_instance\n")),
-1);
}
if (topic_qos.history.kind != DDS::KEEP_LAST_HISTORY_QOS) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong history kind\n")),
-1);
}
if (topic_qos.history.depth != 14) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" wrong history depth\n")),
-1);
}
if (topic_qos.latency_budget.duration.sec != 1) {
ACE_ERROR_RETURN((LM_ERROR,
//.........这里部分代码省略.........