本文整理汇总了C++中dds::Subscriber_var::get_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscriber_var::get_qos方法的具体用法?C++ Subscriber_var::get_qos怎么用?C++ Subscriber_var::get_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Subscriber_var
的用法示例。
在下文中一共展示了Subscriber_var::get_qos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subscriber
void
Test::DataReaderListener::display_partitions (
DDS::DataReader_ptr reader) const
{
// Display requested partition.
DDS::Subscriber_var subscriber (reader->get_subscriber ());
DDS::SubscriberQos sub_qos;
subscriber->get_qos (sub_qos);
DDS::PartitionQosPolicy const & partition = sub_qos.partition;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) Requested Partition\n")
ACE_TEXT ("Partition\tName\n")
ACE_TEXT ("=========\t====\n")));
CORBA::ULong const len = partition.name.length ();
if (len == 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("** Zero length partition name ")
ACE_TEXT ("sequence (default) **\n")));
for (CORBA::ULong i = 0; i != len; ++i)
{
char const * s = partition.name[i];
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT (" %u\t\t%s\n"),
i,
*s == 0 ? "\"\"" : s));
}
}
示例2: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR** argv)
{
try {
OpenDDS::Model::Application application(argc, argv);
SubQos::DefaultSubQosType model(application, argc, argv);
using OpenDDS::Model::SubQos::Elements;
DDS::DataReader_var reader = model.reader( Elements::DataReaders::reader);
DDS::Subscriber_var subscriber = reader->get_subscriber();
ACE_SYNCH_MUTEX lock;
ACE_Condition<ACE_SYNCH_MUTEX> condition(lock);
OpenDDS::Model::ReaderCondSync rcs(reader, condition);
DDS::DataReaderListener_var listener(new ReaderListener(rcs));
reader->set_listener( listener.in(), OpenDDS::DCPS::DEFAULT_STATUS_MASK);
// Call on_data_available in case there are samples which are waiting
listener->on_data_available(reader);
// START OF EXISTING MESSENGER EXAMPLE CODE
MessageDataReader_var reader_i =
MessageDataReader::_narrow(reader);
if (CORBA::is_nil(reader_i.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" _narrow failed!\n")),
-1);
}
DDS::SubscriberQos sub_qos;
if (subscriber->get_qos(sub_qos) != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos failed!\n")),
-1);
}
// was set to false for Sub
if (sub_qos.entity_factory.autoenable_created_entities) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong autoenable value!\n")),
-1);
} else {
if (subscriber->enable() != DDS::RETCODE_OK) {
std::cout << "bad return code enabling subscriber" << std::endl;
}
if (reader->enable() != DDS::RETCODE_OK) {
std::cout << "bad return code enabling reader" << std::endl;
}
}
char* buff = reinterpret_cast<char*>(sub_qos.group_data.value.get_buffer());
std::cout << "Group data is:" << buff << std::endl;
if (strcmp(buff, "eight is 8") != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong group_data value\n")),
-1);
}
if (sub_qos.partition.name.length() != 1) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong # of partitions\n")),
-1);
}
if (strcmp(sub_qos.partition.name[0], "*") != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong partition value\n")),
-1);
}
if (sub_qos.presentation.access_scope != DDS::TOPIC_PRESENTATION_QOS) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong access scope\n")),
-1);
}
if (sub_qos.presentation.coherent_access != true) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong choerent access\n")),
-1);
}
if (sub_qos.presentation.ordered_access != true) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" subscriber has wrong ordered access\n")),
-1);
}
OpenDDS::Model::ReaderSync rs(reader);
//.........这里部分代码省略.........