本文整理汇总了C++中dds::DomainParticipantFactory_var::lookup_participant方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipantFactory_var::lookup_participant方法的具体用法?C++ DomainParticipantFactory_var::lookup_participant怎么用?C++ DomainParticipantFactory_var::lookup_participant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::DomainParticipantFactory_var
的用法示例。
在下文中一共展示了DomainParticipantFactory_var::lookup_participant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
dds::domain::DomainParticipant find(uint32_t id)
{
DDS::DomainParticipantFactory_var dpf = DDS::DomainParticipantFactory::get_instance();
if(dpf.in() == 0)
{
throw dds::core::PreconditionNotMetError(org::opensplice::core::exception_helper(
OSPL_CONTEXT_LITERAL(
"dds::core::PreconditionNotMetError: Unable to resolve the DomainParticipant Factory.")));
}
DDS::DomainParticipant_ptr ddsdp = dpf->lookup_participant(id);
if(ddsdp)
{
dds::domain::DomainParticipant dp =
org::opensplice::core::EntityRegistry<DDS::DomainParticipant_ptr, dds::domain::DomainParticipant>::get(ddsdp);
if(dp != dds::core::null)
{
return dp;
}
}
return dds::domain::DomainParticipant(dds::core::null);
}
示例2: run_domain_test
int run_domain_test ()
{
::DDS::ReturnCode_t ret;
// create participant
::DDS::DomainParticipant_var new_dp
= dpf->create_participant(MY_DOMAIN,
PARTICIPANT_QOS_DEFAULT,
::DDS::DomainParticipantListener::_nil (),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
TEST_CHECK (! CORBA::is_nil (new_dp.in ()));
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) run_domain_test: ")
ACE_TEXT("(! CORBA::is_nil (new_dp.in ()))")
ACE_TEXT("\n")
));
::DDS::DomainId_t domain_id
= new_dp->get_domain_id ();
TEST_CHECK (domain_id == MY_DOMAIN);
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) run_domain_test: ")
ACE_TEXT("(domain_id == MY_DOMAIN)")
ACE_TEXT("\n")
));
MyTypeSupport_var fts (new MyTypeSupportImpl);
if (::DDS::RETCODE_OK != fts->register_type(new_dp.in (), MY_TYPE))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Failed to register the FooTypeSupport.")));
return 1;
}
// lookup existent participant
::DDS::DomainParticipant_var looked_dp
= dpf->lookup_participant(MY_DOMAIN);
OpenDDS::DCPS::DomainParticipantImpl* new_dp_servant
= dynamic_cast<OpenDDS::DCPS::DomainParticipantImpl*>(new_dp.in());
OpenDDS::DCPS::DomainParticipantImpl* looked_dp_servant
= dynamic_cast<OpenDDS::DCPS::DomainParticipantImpl*>(looked_dp.in ());
TEST_CHECK (looked_dp_servant == new_dp_servant);
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) run_domain_test: ")
ACE_TEXT("(looked_dp_servant == new_dp_servant)")
ACE_TEXT("\n")
));
// create topic
::DDS::Topic_var new_topic
= new_dp->create_topic(MY_TOPIC,
MY_TYPE,
TOPIC_QOS_DEFAULT,
::DDS::TopicListener::_nil (),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
OpenDDS::DCPS::TopicImpl* new_topic_servant
= dynamic_cast<OpenDDS::DCPS::TopicImpl*>(new_topic.in ());
::DDS::Duration_t timeout;
timeout.sec = static_cast<long>(find_topic_timeout.sec ());
timeout.nanosec = find_topic_timeout.usec ();
// find existent topic
::DDS::Topic_var found_topic
= new_dp->find_topic(MY_TOPIC, timeout);
::OpenDDS::DCPS::TopicImpl* found_topic_servant
= dynamic_cast<OpenDDS::DCPS::TopicImpl*>
(found_topic.in ());
TEST_CHECK (new_topic_servant == found_topic_servant);
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) run_domain_test: ")
ACE_TEXT("(new_topic_servant == found_topic_servant)")
ACE_TEXT("\n")
));
// find existent topicdescription
::DDS::TopicDescription_var found_topicdescription
= new_dp->lookup_topicdescription(MY_TOPIC);
TEST_CHECK (! CORBA::is_nil (found_topicdescription.in ()));
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) run_domain_test: ")
ACE_TEXT("(! CORBA::is_nil (found_topicdescription.in ()))")
ACE_TEXT("\n")
));
// widen the topicdescription to topic
::DDS::Topic_var widened_topic
= ::DDS::Topic::_narrow(found_topicdescription.in ());
TEST_CHECK (! CORBA::is_nil (widened_topic.in ()));
//.........这里部分代码省略.........