本文整理汇总了C++中dds::Publisher_var::get_participant方法的典型用法代码示例。如果您正苦于以下问题:C++ Publisher_var::get_participant方法的具体用法?C++ Publisher_var::get_participant怎么用?C++ Publisher_var::get_participant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Publisher_var
的用法示例。
在下文中一共展示了Publisher_var::get_participant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
typename OpenDDS::DCPS::DDSTraits<MessageType>::DataWriterType::_var_type
create_writer(const DDS::Publisher_var& pub, const char* topicName,
const DDS::DataWriterQos& qos = DATAWRITER_QOS_DEFAULT,
const DDS::DataWriterListener_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 = pub->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::DataWriter_var dw =
pub->create_datawriter(topic, qos, listener, mask);
return OpenDDS::DCPS::DDSTraits<MessageType>::DataWriterType::_narrow(dw);
}