本文整理汇总了C++中dds::DataWriter_var::get_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ DataWriter_var::get_qos方法的具体用法?C++ DataWriter_var::get_qos怎么用?C++ DataWriter_var::get_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::DataWriter_var
的用法示例。
在下文中一共展示了DataWriter_var::get_qos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR** argv)
{
try {
OpenDDS::Model::Application application(argc, argv);
CopyTopicQosLib::DefaultCopyTopicQosType model(application, argc, argv);
using OpenDDS::Model::CopyTopicQosLib::Elements;
// writer1 copy true
// writer2 copy false
DDS::DataWriter_var writer = model.writer( Elements::DataWriters::writer1);
DDS::DataWriter_var writer2 = model.writer( Elements::DataWriters::writer2);
// START OF EXISTING MESSENGER EXAMPLE CODE
data1::MessageDataWriter_var message_writer =
data1::MessageDataWriter::_narrow(writer.in());
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);
}
DDS::DataWriterQos writer_qos, writer2_qos;
if (writer->get_qos(writer_qos) != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos failed!\n")),
-1);
}
if (writer2->get_qos(writer2_qos) != 0) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos failed!\n")),
-1);
}
// Should get set when copy is true
if (writer_qos.destination_order.kind != DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS) {
std::cout << "publisher, wrong destintion order" << std::endl;
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos gave wrong value!\n")),
-1);
}
// Should not get set when copy is false
if (writer2_qos.destination_order.kind == DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS) {
std::cout << "publisher, wrong destintion order" << std::endl;
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" get_qos gave wrong value!\n")),
-1);
}
OpenDDS::Model::WriterSync ws(writer);
{
// Write samples
data1::Message message;
message.subject_id = 99;
message.from = CORBA::string_dup("Comic Book Guy");
message.subject = CORBA::string_dup("Review");
message.text = CORBA::string_dup("Worst. Movie. Ever.");
message.count = 0;
std::cout << "publisher sending" << std::endl;
for (int i = 0; i < 10; i++) {
DDS::ReturnCode_t error = message_writer->write(message, DDS::HANDLE_NIL);
++message.count;
if (error != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" write returned %d!\n"), error));
}
}
}
// END OF EXISTING MESSENGER EXAMPLE CODE
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
return -1;
} catch( const std::exception& ex) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: main() -")
ACE_TEXT(" Exception caught: %C\n"),
ex.what()),
-1);
}
std::cout << "publisher exiting" << std::endl;
return 0;
}