本文整理汇总了C++中DomainParticipant_var::get_builtin_subscriber方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipant_var::get_builtin_subscriber方法的具体用法?C++ DomainParticipant_var::get_builtin_subscriber怎么用?C++ DomainParticipant_var::get_builtin_subscriber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomainParticipant_var
的用法示例。
在下文中一共展示了DomainParticipant_var::get_builtin_subscriber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_test
bool run_test(DomainParticipant_var& dp_sub,
DomainParticipant_var& dp_pub)
{
OpenDDS::DCPS::RepoId sub_repo_id, pub_repo_id;
{
OpenDDS::DCPS::DomainParticipantImpl* dp_impl =
dynamic_cast<OpenDDS::DCPS::DomainParticipantImpl*>(dp_sub.in());
sub_repo_id = dp_impl->get_id ();
OpenDDS::DCPS::GuidConverter converter(sub_repo_id);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("%P ")
ACE_TEXT("Sub Domain Participant GUID=%C\n"),
std::string(converter).c_str()));
}
{
OpenDDS::DCPS::DomainParticipantImpl* dp_impl =
dynamic_cast<OpenDDS::DCPS::DomainParticipantImpl*>(dp_pub.in());
pub_repo_id = dp_impl->get_id ();
OpenDDS::DCPS::GuidConverter converter(pub_repo_id);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("%P ")
ACE_TEXT("Pub Domain Participant GUID=%C\n"),
std::string(converter).c_str()));
}
// If we are running with an rtps_udp transport, it can't be shared between
// participants.
TransportConfig_rch cfg = TheTransportRegistry->get_config("dp1");
if (!cfg.is_nil()) {
TheTransportRegistry->bind_config(cfg, dp_sub);
}
cfg = TheTransportRegistry->get_config("dp2");
if (!cfg.is_nil()) {
TheTransportRegistry->bind_config(cfg, dp_pub);
}
Subscriber_var bit_sub = dp_sub->get_builtin_subscriber();
if (!read_participant_bit(bit_sub, dp_sub, pub_repo_id, TestConfig::PARTICIPANT_USER_DATA())) {
return false;
}
// Each domain participant's handle to the other
InstanceHandle_t dp_sub_ih, dp_pub_ih;
InstanceHandle_t pub_ih, sub_ih, ig_ih;
if (!(check_discovered_participants(dp_sub, dp_pub_ih) &&
check_discovered_participants(dp_pub, dp_sub_ih)))
{
return false;
}
DataWriter_var dw = create_data_writer(dp_pub);
if (!dw) {
ACE_DEBUG((LM_ERROR, "ERROR: %P could not create Data Writer (participant 2)\n"));
return false;
}
if (!read_publication_bit(bit_sub, dp_sub, pub_repo_id, pub_ih, TestConfig::DATA_WRITER_USER_DATA(), TestConfig::TOPIC_DATA(), 1, 1)) {
return false;
}
DataReader_var dr = create_data_reader(dp_sub);
if (!dr) {
ACE_DEBUG((LM_ERROR, "ERROR: %P could not create Data Reader (participant 1)\n"));
return false;
}
if (!read_subscription_bit(dp_pub->get_builtin_subscriber(), dp_pub, sub_repo_id, sub_ih, TestConfig::DATA_READER_USER_DATA(), TestConfig::TOPIC_DATA())) {
return false;
}
// Wait for the reader to associate with the writer.
WriterSync::wait_match(dw);
// Remove the writer and its topic, then re-create them. The writer's
// participant should still have discovery info about the reader so that
// the association between the new writer and old reader can be established.
recreate_data_writer_and_topic(dw, dr);
// Wait for the reader to associate with the writer.
WriterSync::wait_match(dw);
// The new writer is associated with the reader, but the reader may still
// also be associated with the old writer.
wait_match(dr, 1);
// Get the new instance handle as pub_ih
if (!read_publication_bit(bit_sub, dp_sub, pub_repo_id, pub_ih, TestConfig::DATA_WRITER_USER_DATA(), TestConfig::TOPIC_DATA(), 1, 2)) {
return false;
}
TestMsgDataWriter_var tmdw = TestMsgDataWriter::_narrow(dw);
const TestMsg msg = {42};
tmdw->write(msg, HANDLE_NIL);
ReadCondition_var rc = dr->create_readcondition(ANY_SAMPLE_STATE,
ANY_VIEW_STATE,
ALIVE_INSTANCE_STATE);
//.........这里部分代码省略.........