当前位置: 首页 > wzjs >正文

soho网站建设内蒙古工程建设招投标中心网站

soho网站建设,内蒙古工程建设招投标中心网站,南昌网站建设行业现状,企业网站手机端太简洁DDS(Data Distribution Service数据分发服务)是对象管理组织OMG的有关分布式实时系统中数据发布的规范。 DDS规范采用了发布/订阅体系结构,但对实时性要求提供更好的支持。DDS是以数据为中心的发布/订阅通信模型。 以下工程基于rti_connext_dds-7.2.0 hello_world.…

DDS(Data Distribution Service数据分发服务)是对象管理组织OMG的有关分布式实时系统中数据发布的规范。
DDS规范采用了发布/订阅体系结构,但对实时性要求提供更好的支持。DDS是以数据为中心的发布/订阅通信模型。

以下工程基于rti_connext_dds-7.2.0
hello_world.idl定义的HelloWorld结构体如下

在这里插入图片描述

使用RTI Code Generator(rtiddsgen)生成对应工程。

在这里插入图片描述

生成的工程目录如下

在这里插入图片描述

用VS2017打开工程
重点关注 hello_world_publisher.cxx和 hello_world_subscriber.cxx两个文件

Publisher

publisher实现的是发布,subscriber实现的是订阅。
在hello_world_publisher.cxx中

    // 创建一个HelloWorld类型以HelloWorld Topic命名的Topicdds::topic::Topic<HelloWorld> topic(participant, "HelloWorld Topic");dds::pub::Publisher publisher(participant);// DataWriter将要在"HelloWorld Topic"中写入数据dds::pub::DataWriter<HelloWorld> writer(publisher, topic);

定义HelloWorld类型的sample,sample.msg()定义sample输出的内容
通过write函数写入数据

    HelloWorld sample;for (unsigned int count = 0;!shutdown_requested && count < sample_count;count++) {sample.msg("Hello world! " + std::to_string(count));std::cout << "Writing HelloWorld, count " << count << std::endl;writer.write(sample);rti::util::sleep(dds::core::Duration(4));}

Subscriber

类似的,定义Subscriber

    // 创建一个HelloWorld类型以HelloWorld Topic命名的Topicdds::topic::Topic<HelloWorld> topic(participant, "HelloWorld Topic");dds::sub::Subscriber subscriber(participant);// DataReader将要读取topic数据dds::sub::DataReader<HelloWorld> reader(subscriber, topic);

创建状态条件,满足条件才读取数据

    // 创建条件dds::core::cond::StatusCondition status_condition(reader);status_condition.enabled_statuses(dds::core::status::StatusMask::data_available());// 条件触发后关联句柄unsigned int samples_read = 0;status_condition.extensions().handler([&reader, &samples_read]() {samples_read += process_data(reader);});
	dds::core::cond::WaitSet waitset;waitset += status_condition;while (!shutdown_requested && samples_read < sample_count) {// 条件激活std::cout << "HelloWorld subscriber sleeping for 4 sec..."<< std::endl;waitset.dispatch(dds::core::Duration(4));  // Wait up to 4s each time}

文章转载自:

http://5OI62aCT.jzLrr.cn
http://3biMPyJf.jzLrr.cn
http://Lq7LrYvD.jzLrr.cn
http://oA5caxTH.jzLrr.cn
http://rdLhlz8e.jzLrr.cn
http://PbEX35FX.jzLrr.cn
http://u4weX6Jy.jzLrr.cn
http://E53wOiOv.jzLrr.cn
http://p1y13D0S.jzLrr.cn
http://es9TsCSM.jzLrr.cn
http://KtQj6eeB.jzLrr.cn
http://0gQA46Um.jzLrr.cn
http://KNSY2XqA.jzLrr.cn
http://X1sQHFNN.jzLrr.cn
http://FlxAdOWd.jzLrr.cn
http://mQfEiPvF.jzLrr.cn
http://3aB5g8aJ.jzLrr.cn
http://ivrDF9Pz.jzLrr.cn
http://kKCSKJrn.jzLrr.cn
http://iwqmong4.jzLrr.cn
http://J6QINNBZ.jzLrr.cn
http://5Q0bbdz6.jzLrr.cn
http://cKJ3oofV.jzLrr.cn
http://LM3sLc7q.jzLrr.cn
http://YZQPwGQQ.jzLrr.cn
http://o2x097mA.jzLrr.cn
http://4YLAhNbF.jzLrr.cn
http://wpbMPfKb.jzLrr.cn
http://O7PgCgSa.jzLrr.cn
http://r4hd8DdZ.jzLrr.cn
http://www.dtcms.com/wzjs/691944.html

相关文章:

  • 微信公众号内置手机网站网络文化经营许可证在哪里办
  • 常州建设安全员报名网站金融系统网站模板
  • 做暧嗳网站wordpress插件 2017
  • 做外单网站有哪些wordpress分享插件
  • 深圳市专业制作网站公司做网站用框架好吗
  • 门户网站开发意义yw55521can优物入口
  • 科技网站建设公司wordpress中文路径
  • 宋家庄网站建设网站的建设费用属于什么科目
  • 淮安做网站杨凯旅游网站设计说明
  • ui是做网站的吗免费cad图纸下载网
  • 高校网站建设评比标准温州vi设计公司
  • 网站怎么做背景不变页面滑动wordpress的修改后主题后台出现已损坏的修复
  • 网站建设调查回访表家装设计效果图网站
  • 网站标题在线制作图书网站建设源码
  • 怎样做企业手机网站微站
  • 专业系统网站怎样免费创建网站
  • 网站建设客源开发衡水seo培训
  • 网站建设注册小程序word网站的链接怎么做
  • 在哪里推广网站深圳公司社保网站
  • php mysql开发网站开发福建住房和城乡建设厅网站一体化平台
  • 南昌制作手机网站推广普通话宣传语手抄报
  • 惠州网站建设哪里找临沂企业自助建站
  • 专门做库存的网站免费网站备案号码
  • 南昌手机建站模板生猪期货交易平台 app
  • 用网站ip做代理WordPress采集微信
  • wordpress中文案例seo最新
  • 中标公告 网站建设杭州网络运营公司排名
  • 优良网站网站域名备案转接入手续
  • 高端做网站哪家好copyright技术支持 东莞网站建设
  • 揭阳企业网站建设公司免费网站电视剧全免费的app