本文整理汇总了C++中DomainParticipant_var::get_discovered_participant_data方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipant_var::get_discovered_participant_data方法的具体用法?C++ DomainParticipant_var::get_discovered_participant_data怎么用?C++ DomainParticipant_var::get_discovered_participant_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomainParticipant_var
的用法示例。
在下文中一共展示了DomainParticipant_var::get_discovered_participant_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_discovered_participants
bool check_discovered_participants(DomainParticipant_var& dp,
InstanceHandle_t& handle)
{
InstanceHandle_t my_handle = dp->get_instance_handle();
DDS::InstanceHandleSeq part_handles;
DDS::ReturnCode_t stat = dp->get_discovered_participants(part_handles);
while (stat == RETCODE_NO_DATA || part_handles.length() == 0) {
ACE_OS::sleep(1);
stat = dp->get_discovered_participants(part_handles);
}
if (stat == RETCODE_OK) {
CORBA::ULong len = part_handles.length();
if (len != 1) {
ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %P expected to discover")
ACE_TEXT("one other participant handle but ")
ACE_TEXT("found %d\n"), len), false);
} else if (part_handles[0] == my_handle) {
ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %P discovered own ")
ACE_TEXT("participant handle\n")), false);
} else {
DDS::ParticipantBuiltinTopicData data;
dp->get_discovered_participant_data(data, part_handles[0]);
OpenDDS::DCPS::Discovery_rch disc =
TheServiceParticipant->get_discovery(dp->get_domain_id());
OpenDDS::DCPS::DomainParticipantImpl* dp_impl =
dynamic_cast<OpenDDS::DCPS::DomainParticipantImpl*>(dp.in());
OpenDDS::DCPS::RepoId repo_id = disc->bit_key_to_repo_id(
dp_impl,
OpenDDS::DCPS::BUILT_IN_PARTICIPANT_TOPIC,
data.key);
if (dp_impl->get_handle(repo_id) != part_handles[0]) {
ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %P discovered participant ")
ACE_TEXT("BIT key could not be converted ")
ACE_TEXT("to repo id, then handle\n")),
false);
}
handle = part_handles[0];
{
OpenDDS::DCPS::GuidConverter converter1(dp_impl->get_id ());
OpenDDS::DCPS::GuidConverter converter2(repo_id);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("%P ")
ACE_TEXT("%C discovered %C\n"),
std::string(converter1).c_str(),
std::string(converter2).c_str()));
}
}
}
return (stat == RETCODE_OK);
}