本文整理汇总了C++中dds::Subscriber_var::set_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscriber_var::set_qos方法的具体用法?C++ Subscriber_var::set_qos怎么用?C++ Subscriber_var::set_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Subscriber_var
的用法示例。
在下文中一共展示了Subscriber_var::set_qos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_TMAIN
//.........这里部分代码省略.........
DDS::Subscriber_var builtin = participant->get_builtin_subscriber();
DDS::DataReader_var bitdr =
builtin->lookup_datareader(OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC);
listener_servant->set_builtin_datareader(bitdr.in());
if (CORBA::is_nil (listener.in ())) {
cerr << "subscriber: listener is nil." << endl;
exit(1);
}
// Create the Datareaders
DDS::DataReaderQos dr_qos;
sub->get_default_datareader_qos (dr_qos);
// set up user data in DR qos
CORBA::ULong dr_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (DR_USER_DATA));
dr_qos.user_data.value.length (dr_user_data_len);
dr_qos.user_data.value.replace (dr_user_data_len,
dr_user_data_len,
reinterpret_cast<CORBA::Octet*>(DR_USER_DATA));
DDS::DataReader_var dr = sub->create_datareader(topic.in (),
dr_qos,
listener.in (),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (dr.in ())) {
cerr << "subscriber: create_datareader failed." << endl;
exit(1);
}
// Wait for Monitor 1 done.
FILE* fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r"));
int i = 0;
while (fp == 0 && i < 15)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%P|%t) waiting monitor1 done ...\n")));
ACE_OS::sleep (1);
++i;
fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r"));
}
if (fp != 0)
ACE_OS::fclose (fp);
// Now change the changeable qos. The second monitor should get the updated qos from BIT.
part_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_PART_USER_DATA));
partQos.user_data.value.length (part_user_data_len);
partQos.user_data.value.replace (part_user_data_len,
part_user_data_len,
reinterpret_cast<CORBA::Octet*>(UPDATED_PART_USER_DATA));
participant->set_qos (partQos);
dr_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_DR_USER_DATA));
dr_qos.user_data.value.length (dr_user_data_len);
dr_qos.user_data.value.replace (dr_user_data_len,
dr_user_data_len,
reinterpret_cast<CORBA::Octet*>(UPDATED_DR_USER_DATA));
dr->set_qos (dr_qos);
group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (UPDATED_GROUP_DATA));
sub_qos.group_data.value.length (group_data_len);
sub_qos.group_data.value.replace (group_data_len,
group_data_len,
reinterpret_cast<CORBA::Octet*>(UPDATED_GROUP_DATA));
sub->set_qos (sub_qos);
topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_TOPIC_DATA));
topic_qos.topic_data.value.length (topic_data_len);
topic_qos.topic_data.value.replace (topic_data_len,
topic_data_len,
reinterpret_cast<CORBA::Octet*>(UPDATED_TOPIC_DATA));
topic->set_qos (topic_qos);
while ( listener_servant->num_reads() < num_messages) {
ACE_OS::sleep (1);
}
if (listener_servant->builtin_read_errors()) {
cerr << "subscriber: Built in topic read failure." << endl;
result = 1;
}
if (!CORBA::is_nil (participant.in ())) {
participant->delete_contained_entities();
}
if (!CORBA::is_nil (dpf.in ())) {
dpf->delete_participant(participant.in ());
}
TheServiceParticipant->shutdown ();
}
catch (CORBA::Exception& e)
{
cerr << "subscriber: SUB: Exception caught in main ():" << endl << e << endl;
return 1;
}
return result;
}