本文整理汇总了C++中dds::Publisher_var::get_instance_handle方法的典型用法代码示例。如果您正苦于以下问题:C++ Publisher_var::get_instance_handle方法的具体用法?C++ Publisher_var::get_instance_handle怎么用?C++ Publisher_var::get_instance_handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::Publisher_var
的用法示例。
在下文中一共展示了Publisher_var::get_instance_handle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
DWMonitorImpl::report() {
if (!CORBA::is_nil(this->dw_writer_.in())) {
DataWriterReport report;
report.dp_id = this->dw_->get_dp_id();
DDS::Publisher_var pub = this->dw_->get_publisher();
report.pub_handle = pub->get_instance_handle();
report.dw_id = this->dw_->get_publication_id();
DDS::Topic_var topic = this->dw_->get_topic();
report.topic_id = dynamic_cast<TopicImpl*>(topic.in())->get_id();
DataWriterImpl::InstanceHandleVec instances;
this->dw_->get_instance_handles(instances);
CORBA::ULong length = 0;
report.instances.length(static_cast<CORBA::ULong>(instances.size()));
for (DataWriterImpl::InstanceHandleVec::iterator iter = instances.begin();
iter != instances.end();
++iter) {
report.instances[length++] = *iter;
}
DataWriterImpl::IdSet readers;
this->dw_->get_readers(readers);
length = 0;
report.associations.length(static_cast<CORBA::ULong>(readers.size()));
for (DataWriterImpl::IdSet::iterator iter = readers.begin();
iter != readers.end();
++iter) {
report.associations[length].dr_id = *iter;
length++;
}
this->dw_writer_->write(report, DDS::HANDLE_NIL);
}
}