本文整理汇总了C++中dds::Subscriber_var::get_participant方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscriber_var::get_participant方法的具体用法?C++ Subscriber_var::get_participant怎么用?C++ Subscriber_var::get_participant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Subscriber_var
的用法示例。
在下文中一共展示了Subscriber_var::get_participant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Destroy_Connection
void Destroy_Connection(CONNECTION_ID_TYPE connection_id,
RETURN_CODE_TYPE& return_code)
{
Entities& entities = *Entities::instance();
std::map<CONNECTION_ID_TYPE, ::DDS::DataWriter_var>& writers = entities.writers_;
std::map<CONNECTION_ID_TYPE, ::DDS::DataReader_var>& readers = entities.readers_;
::DDS::DomainParticipant_var dp;
if (writers.count(connection_id)) {
const ::DDS::Publisher_var pub = writers[connection_id]->get_publisher();
writers.erase(connection_id);
dp = pub->get_participant();
} else if (readers.count(connection_id)) {
const ::DDS::Subscriber_var sub = readers[connection_id]->get_subscriber();
readers.erase(connection_id);
dp = sub->get_participant();
}
if (!dp) {
return_code = INVALID_PARAM;
return;
}
dp->delete_contained_entities();
const ::DDS::DomainParticipantFactory_var dpf = TheParticipantFactory;
dpf->delete_participant(dp);
entities.connections_.erase(connection_id);
return_code = RC_NO_ERROR;
}
示例2:
DDS::DataReader_var
create_reader(const DDS::Subscriber_var& sub, const char* topicName,
const DDS::DataReaderQos& qos = DATAREADER_QOS_DEFAULT,
const DDS::DataReaderListener_var& listener = 0,
const DDS::StatusMask& mask = OpenDDS::DCPS::DEFAULT_STATUS_MASK)
{
const DDS::TypeSupport_var ts = new ::OpenDDS::DCPS::TypeSupportImpl_T<MessageType>();
const DDS::DomainParticipant_var dp = sub->get_participant();
const CORBA::String_var typeName = ts->get_type_name();
(void) ts->register_type(dp, typeName); // may have been registered before
const DDS::Topic_var topic =
dp->create_topic(topicName, typeName, TOPIC_QOS_DEFAULT, 0, 0);
if (!topic) return 0;
const DDS::DataReader_var dr =
sub->create_datareader(topic, qos, listener, mask);
return OpenDDS::DCPS::DDSTraits<MessageType>::DataReaderType::_narrow(dr);
}
示例3: rd
DDS::DataReader_var
Factory::reader(const DDS::Subscriber_var& sub, const DDS::Topic_var& topic, const DDS::DataReaderListener_var& drl) const
{
// Create the data readers
DDS::DataReaderQos dr_qos;
sub->get_default_datareader_qos(dr_qos);
dr_qos.durability.kind = opts_.durability_kind;
dr_qos.liveliness.kind = opts_.liveliness_kind;
dr_qos.liveliness.lease_duration = opts_.LEASE_DURATION;
dr_qos.reliability.kind = opts_.reliability_kind;
DDS::DomainParticipant_var dp = sub->get_participant();
CORBA::String_var tn = topic->get_name();
DDS::TopicDescription_var description = dp->lookup_topicdescription(tn);
TEST_ASSERT(!CORBA::is_nil(description.in()));
DDS::DataReader_var rd(sub->create_datareader(description.in(),
dr_qos,
drl.in(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK));
// Initialize the transport configuration for the appropriate entity
TEST_ASSERT(!opts_.configuration_str.empty());
if (opts_.configuration_str != "none" && opts_.entity_str == "rw")
{
OpenDDS::DCPS::TransportRegistry::instance()->bind_config(opts_.configuration_str,
rd.in());
if (!opts_.entity_autoenable)
{
TEST_ASSERT(DDS::RETCODE_OK == rd->enable());
}
}
return rd;
}