本文整理汇总了C++中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使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber_var
的用法示例。
在下文中一共展示了Subscriber_var::copy_from_topic_qos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkHandle
//.........这里部分代码省略.........
nameServiceTopic = participant->create_topic(
"Chat_NameService",
nameServiceTypeName,
setting_topic_qos,
NULL,
STATUS_MASK_NONE);
checkHandle(nameServiceTopic.in(), "DDS::DomainParticipant::create_topic");
/* Adapt the default SubscriberQos to read from the "ChatRoom" Partition. */
status = participant->get_default_subscriber_qos (sub_qos);
checkStatus(status, "DDS::DomainParticipant::get_default_subscriber_qos");
sub_qos.partition.name.length(1);
sub_qos.partition.name[0UL] = "ChatRoom";
/* Create a Subscriber for the UserLoad application. */
chatSubscriber = participant->create_subscriber(sub_qos, NULL, STATUS_MASK_NONE);
checkHandle(chatSubscriber.in(), "DDS::DomainParticipant::create_subscriber");
/* Create a DataReader for the NameService Topic (using the appropriate QoS). */
parentReader = chatSubscriber->create_datareader(
nameServiceTopic.in(),
DATAREADER_QOS_USE_TOPIC_QOS,
NULL,
STATUS_MASK_NONE);
checkHandle(parentReader, "DDS::Subscriber::create_datareader (NameService)");
/* Narrow the abstract parent into its typed representative. */
nameServer = NameServiceDataReader::_narrow(parentReader);
checkHandle(nameServer.in(), "Chat::NameServiceDataReader::_narrow");
/* Adapt the DataReaderQos for the ChatMessageDataReader to keep track of all messages. */
status = chatSubscriber->get_default_datareader_qos(message_qos);
checkStatus(status, "DDS::Subscriber::get_default_datareader_qos");
status = chatSubscriber->copy_from_topic_qos(message_qos, reliable_topic_qos);
checkStatus(status, "DDS::Subscriber::copy_from_topic_qos");
message_qos.history.kind = KEEP_ALL_HISTORY_QOS;
/* Create a DataReader for the ChatMessage Topic (using the appropriate QoS). */
parentReader = chatSubscriber->create_datareader(
chatMessageTopic.in(),
message_qos,
NULL,
STATUS_MASK_NONE);
checkHandle(parentReader, "DDS::Subscriber::create_datareader (ChatMessage)");
/* Narrow the abstract parent into its typed representative. */
loadAdmin = ChatMessageDataReader::_narrow(parentReader);
checkHandle(loadAdmin.in(), "Chat::ChatMessageDataReader::_narrow");
/* Initialize the Query Arguments. */
args.length(1);
args[0UL] = "0";
/* Create a QueryCondition that will contain all messages with userID=ownID */
singleUser = loadAdmin->create_querycondition(
ANY_SAMPLE_STATE,
ANY_VIEW_STATE,
ANY_INSTANCE_STATE,
"userID=%0",
args);
checkHandle(singleUser.in(), "DDS::DataReader::create_querycondition");
/* Create a ReadCondition that will contain new users only */
newUser = nameServer->create_readcondition(
NOT_READ_SAMPLE_STATE,
NEW_VIEW_STATE,