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

怎么做营销型网站设计co域名网站

怎么做营销型网站设计,co域名网站,wordpress直达链接,做示意图的网站基于OpenDDS的应用开发#xff0c;主要分两个部分的工作#xff1a; #xff08;1#xff09;定义自己的IDL文件#xff0c;并编译成消息数据类型通讯动态库#xff1b; #xff08;2#xff09;分别编写pub和sub程序#xff0c;运行 具体步骤#xff0c;有以下几…基于OpenDDS的应用开发主要分两个部分的工作 1定义自己的IDL文件并编译成消息数据类型通讯动态库 2分别编写pub和sub程序运行 具体步骤有以下几个 定义idl文件如HelloMsg.ild运行脚本产生相应的消息类型符号导出头文件HelloMsgCommon_Export.h编写mwc、mpc工作台和项目文件如HelloMsg.mwc、HelloMsg.mpc编译mpc文件产生解决方案和工程如HelloMsg.sln、HelloMsgCommon.vcxproj、HelloMsgPub.vcxproj、HelloMsgSub.vcxproj编写HelloMsgPub.cpp和HelloMsgSub.cpp代码编译工程产生动态库HelloMsgCommon.dll、HelloMsgPub.exe、HelloMsgSub.exe运行发布和订阅程序查看运行结果 下面展开来看。。。 步骤一、定义HelloMsg.idl module Hello {#pragma DCPS_DATA_TYPE Hello::HelloMsg#pragma DCPS_DATA_KEY Hello::HelloMsg msgstruct HelloMsg{string msg;}; }; 步骤二、制作HelloMsg消息导出符号头文件HelloMsgCommon_Export.h perl %ACE_ROOT%/bin/generate_export_file.pl HelloMsgCommon HelloMsgCommon_Export.h 步骤三、定义HelloMsg.mwc、HelloMsg.mpc workspace {// the -relative and -include cmdlines make it so this workspace // does not have to be in the $DDS_ROOT directory tree.// tell MPC to substitute our DDS_ROOT environment variables for relative pathscmdline -relative DDS_ROOT$DDS_ROOT// tell the projects where to find the DDS base projects (*.mpb)cmdline -include $DDS_ROOT/MPC/config} project(*Common) : dcps {sharedname HelloMsgCommondynamicflags HELLOMSGCOMMON_BUILD_DLLlibout .requires tao_orbsvcsrequires no_opendds_safety_profileafter Svc_Utilsincludes $(TAO_ROOT)/orbsvcsidlflags -I$(TAO_ROOT)/orbsvcs \-Wb,export_macroHelloMsgCommon_Export \-Wb,export_includeHelloMsgCommon_Export.hdcps_ts_flags -Wb,export_macroHelloMsgCommon_ExportTypeSupport_Files {HelloMsg.idl}IDL_Files {HelloMsgTypeSupport.idlHelloMsg.idl}// We only want the generated filesHeader_Files {}// We only want the generated filesSource_Files {} }project(HelloMsgPub) : dcpsexe, dcps_tcp, svc_utils {after *Commonexename HelloMsgPubrequires tao_orbsvcsrequires no_opendds_safety_profileincludes $(TAO_ROOT)/orbsvcslibs HelloMsgCommonIDL_Files {}TypeSupport_Files {}Header_Files {}Source_Files {HelloMsgPub.cpp}Documentation_Files {dds_tcp_conf.inidds_udp_conf.ini} }project(HelloMsgSub) : dcpsexe, dcps_tcp {after *Commonexename HelloMsgSubrequires tao_orbsvcsrequires no_opendds_safety_profileincludes $(TAO_ROOT)/orbsvcslibs HelloMsgCommonTypeSupport_Files {}IDL_Files {}Header_Files {}Source_Files {HelloMsgSub.cpp}Documentation_Files {dds_tcp_conf.inidds_udp_conf.ini} } 步骤四产生vs2010的工程文件 perl %ACE_ROOT%/bin/mwc.pl -type vc10 HelloMsg.mwc产生HelloMsg.sln、HelloMsg_Common.vcxproj、HelloMsgPub.vcxproj和HelloMsgSub.vcxproj步骤五、编写HelloMsgPub.cpp和HelloMsgSub.cpp代码 HelloMsgPub.cpp /****************************************************************** file: HelloMsgPub.cpp* desc: Provides a simple C hello world DDS publisher.* This publishing application will send data* to the example hello world subscribing * application (hello_sub).* ****************************************************************/ #include dds/DCPS/Service_Participant.h #include dds/DCPS/Marked_Default_Qos.h #include dds/DCPS/PublisherImpl.h #include dds/DCPS/StaticIncludes.h #include ace/streams.h #include orbsvcs/Time_Utilities.h#include stdio.h #include string.h #ifdef _WIN32 #include windows.h #else #include unistd.h #endif #include HelloMsgTypeSupportImpl.h/***************************************************************** main()** Perform OpenDDS setup activities:* - create a Domain Participant* - create a Publisher* - register the StringMsg data type* - create a Topic* - create a DataWriter * Write data****************************************************************/int main(int argc, char * argv[]) {DDS::DomainParticipant * domain;DDS::Publisher * publisher;DDS::Topic * topic;DDS::DataWriter * dw;Hello::StringMsg stringMsg;DDS::ReturnCode_t retval;DDS::DomainParticipantFactory *dpf TheParticipantFactoryWithArgs(argc, argv); if ( dpf NULL ) { printf(ERROR initializing domainParticipantFactory.\n); return -1; } /* create a DomainParticipant */domain dpf-create_participant( 2, PARTICIPANT_QOS_DEFAULT, NULL, 0 );if ( domain NULL ){printf(ERROR creating domain participant.\n);return -1;}/* create a Publisher */publisher domain-create_publisher(PUBLISHER_QOS_DEFAULT, NULL, 0 );if ( publisher NULL ){printf(ERROR creating publisher.\n);return -1;}/* Register the data type with the OpenDDS middleware. * This is required before creating a Topic with* this data type. */Hello::StringMsgTypeSupport *stringMsgTS new Hello::StringMsgTypeSupportImpl();;retval stringMsgTS-register_type( domain, StringMsg );if (retval ! DDS::RETCODE_OK){printf(ERROR registering type: %s\n, DDS_error(retval));return -1;}/* Create a DDS Topic with the StringMsg data type. */topic domain-create_topic(helloTopic, StringMsg, TOPIC_QOS_DEFAULT, NULL, 0 );if ( topic NULL ){printf(ERROR creating topic.\n);return -1;}/* Create a DataWriter on the hello topic, with* default QoS settings and no listeners.*/dw publisher-create_datawriter( topic, DATAWRITER_QOS_DEFAULT, NULL, 0 );if (dw NULL){printf(ERROR creating data writer\n);return -1;}/* Initialize the data to send. The StringMsg data type* has just one string member.* Note: Alwyas initialize a string member with* allocated memory -- the destructor will free * all string members. */stringMsg.msg new char[1024];strcpy((char*)stringMsg.msg.in(), Hello World from C!);int counter 1;Hello::StringMsgDataWriter* sm_dw Hello::StringMsgDataWriter::_narrow(dw);while ( 1 ){sprintf((char*)stringMsg.msg.in(), Hello World from OpenDDS C! index%d, counter);DDS::ReturnCode_t ret sm_dw-write ( stringMsg, DDS::HANDLE_NIL ); printf(OpenDDS wrote a sample, index%d\n, counter);fflush(stdout);if ( ret ! DDS::RETCODE_OK) {printf(ERROR writing sample\n);return -1; } #ifdef _WIN32Sleep(1000); #elsesleep(1); #endifcounter;}/* Cleanup */retval domain - delete_contained_entities();if ( retval ! DDS::RETCODE_OK )printf(ERROR (%s): Unable to cleanup DDS entities\n,DDS_error(retval));dpf-delete_participant(domain); TheServiceParticipant-shutdown();return 0; } HelloMsgSub.cpp /****************************************************************** file: HelloMsgSub.cpp* desc: Provides a simple C Hello World DDS subscriber.* This subscribing application will receive data* from the example hello world publishing * application (hello_pub).* ****************************************************************/ #include dds/DCPS/Service_Participant.h #include dds/DCPS/Marked_Default_Qos.h #include dds/DCPS/PublisherImpl.h #include ace/streams.h #include orbsvcs/Time_Utilities.h#include dds/DCPS/StaticIncludes.h#include stdio.h #ifdef _WIN32 #include windows.h #else #include unistd.h #endif #include HelloMsgTypeSupportImpl.h#ifdef _WIN32 # define SLEEP(a) Sleep(a*1000) #else # define SLEEP(a) sleep(a); #endifint all_done 0;/***************************************************************** Construct a DataReaderListener and override the * on_data_available() method with our own. All other* listener methods will be default (no-op) functions.****************************************************************/ class SubListener : public DDS::DataReaderListener { public:void on_data_available( DDS::DataReader * dr );void on_requested_deadline_missed (DDS::DataReader_ptr reader,const DDS::RequestedDeadlineMissedStatus status);void on_requested_incompatible_qos (DDS::DataReader_ptr reader,const DDS::RequestedIncompatibleQosStatus status);void on_liveliness_changed (DDS::DataReader_ptr reader,const DDS::LivelinessChangedStatus status);virtual void on_subscription_matched (DDS::DataReader_ptr reader,const DDS::SubscriptionMatchedStatus status);void on_sample_rejected(DDS::DataReader_ptr reader,const DDS::SampleRejectedStatus status);void on_sample_lost(DDS::DataReader_ptr reader,const DDS::SampleLostStatus status); };/***************************************************************** DataReader Listener Method: on_data_avail()** This listener method is called when data is available to* be read on this DataReader.****************************************************************/ void SubListener::on_data_available( DDS::DataReader * dr) {Hello::StringMsgSeq samples;DDS::SampleInfoSeq samples_info;DDS::ReturnCode_t retval;DDS::SampleStateMask ss DDS::ANY_SAMPLE_STATE;DDS::ViewStateMask vs DDS::ANY_VIEW_STATE;DDS::InstanceStateMask is DDS::ANY_INSTANCE_STATE;/* Convert to our type-specific DataReader */Hello::StringMsgDataReader* reader Hello::StringMsgDataReader::_narrow( dr );/* Take any and all available samples. The take() operation* will remove the samples from the DataReader so they* wont be available on subsequent read() or take() calls.*/retval reader-take( samples, samples_info, DDS::LENGTH_UNLIMITED, ss, vs, is );if ( retval DDS::RETCODE_OK ){/* iterrate through the samples */ for ( unsigned int i 0;i samples.length(); i) {/* If this sample does not contain valid data,* it is a dispose or other non-data command,* and, accessing any member from this sample * would be invalid.*/if ( samples_info[i].valid_data)printf(OpenDDS received a sample, No%d/%d, [%s]\n, i, samples.length(), samples[i].msg.in()); }fflush(stdout);/* read() and take() always loan the data, we need to* return it so OpenDDS can release resources associated* with it. */reader-return_loan( samples, samples_info );}else{printf(ERROR (%s) taking samples from DataReader\n,DDS_error(retval));} }void SubListener::on_requested_deadline_missed ( DDS::DataReader_ptr reader, const DDS::RequestedDeadlineMissedStatus status) {printf(ERROR (%s) on_requested_deadline_missed\n,DDS_error(retval)); }void SubListener::on_requested_incompatible_qos ( DDS::DataReader_ptr reader, const DDS::RequestedIncompatibleQosStatus status) { printf(ERROR (%s) on_requested_incompatible_qos\n, DDS_error(retval)); }void SubListener::on_liveliness_changed ( DDS::DataReader_ptr reader, const DDS::LivelinessChangedStatus status) { printf(ERROR (%s) on_liveliness_changed\n, DDS_error(retval)); }void SubListener::on_subscription_matched ( DDS::DataReader_ptr reader, const DDS::SubscriptionMatchedStatus status ) { printf(ERROR (%s) on_subscription_matched\n, DDS_error(retval)); }void SubListener::on_sample_rejected( DDS::DataReader_ptr reader, const DDS::SampleRejectedStatus status ) { printf(ERROR (%s) on_sample_rejected\n, DDS_error(retval)); }void SubListener::on_sample_lost( DDS::DataReader_ptr reader, const DDS::SampleLostStatus status ) { printf(ERROR (%s) on_sample_lost\n, DDS_error(retval)); }/***************************************************************** main()** Perform OpenDDS setup activities:* - create a Domain Participant* - create a Subscriber* - register the StringMsg data type* - create a Topic* - create a DataReader and attach the listener created above* And wait for data****************************************************************/#if defined(__vxworks) !defined(__RTP__) int hello_sub(char * args) #else int main(int argc, char * argv[]) #endif {DDS::DomainParticipant * domain;DDS::Subscriber * subscriber;DDS::Topic * topic;DDS::DataReader * dr;SubListener drListener;DDS::ReturnCode_t retval;/* Get an instance of the DDS DomainPartiticpantFactory -- * we will use this to create a DomainParticipant.*/DDS::DomainParticipantFactory *dpf TheParticipantFactoryWithArgs(argc, argv); if ( dpf NULL ) { printf(ERROR initializing domainParticipantFactory.\n); return -1; } /* create a DomainParticipant */domain dpf-create_participant( 2, PARTICIPANT_QOS_DEFAULT, NULL, 0 );if ( domain NULL ){printf(ERROR creating domain participant.\n);return -1;}/* create a Subscriber */subscriber domain-create_subscriber(SUBSCRIBER_QOS_DEFAULT, NULL, 0 );if ( subscriber NULL ){printf(ERROR creating subscriber\n);return -1;}/* Register the data type with the OpenDDS middleware. * This is required before creating a Topic with* this data type. */Hello::StringMsgTypeSupport *stringMsgTS new Hello::StringMsgTypeSupportImpl();;retval stringMsgTS-register_type( domain, StringMsg );if (retval ! DDS::RETCODE_OK){printf(ERROR registering type: %s\n, DDS_error(retval));return -1;}/* create a DDS Topic with the StringMsg data type. */topic domain-create_topic( helloTopic, StringMsg, TOPIC_QOS_DEFAULT, NULL, 0 );if ( ! topic ){printf(ERROR creating topic\n);return -1;}/* create a DDS_DataReader on the hello topic (notice* the TopicDescription is used) with default QoS settings, * and attach our listener with our on_data_available method.*/dr subscriber-create_datareader( (DDS::TopicDescription*)topic, DATAREADER_QOS_DEFAULT,drListener, DDS::DATA_AVAILABLE_STATUS );if ( ! dr ){printf(ERROR creating data reader\n);return -1;}/* Wait forever. When data arrives at our DataReader, * our dr_on_data_avilalbe method will be invoked.*/while ( !all_done )SLEEP(30);/* Cleanup */retval domain - delete_contained_entities();if ( retval ! DDS::RETCODE_OK )printf(ERROR (%s): Unable to cleanup DDS entities\n,DDS_error(retval));dpf-delete_participant(domain); TheServiceParticipant-shutdown();return 0; } 步骤六、编译工程 打开HelloMsg.sln产生动态库HelloMsg_Common.dll.lib和发布订阅程序HelloMsgPub.exe和HelloMsgSub.exe 步骤七、运行发布订阅程序 HelloMsgPub -ORBDebugLevel 0 -DCPSDebugLevel 0 -DCPSTransportDebugLevel 0 -DCPSConfigFile ../../etc/dds_udp_conf.ini -ORBLogFile publisher.log OpenDDS wrote a sample, index1 OpenDDS wrote a sample, index2 OpenDDS wrote a sample, index3 OpenDDS wrote a sample, index4 OpenDDS wrote a sample, index5 OpenDDS wrote a sample, index6 OpenDDS wrote a sample, index7 OpenDDS wrote a sample, index8 OpenDDS wrote a sample, index9 OpenDDS wrote a sample, index10 HelloMsgSub -ORBDebugLevel 0 -DCPSDebugLevel 0 -DCPSTransportDebugLevel 0 -DCPSConfigFile ../../etc/dds_udp_conf.ini -ORBLogFile subscriber.log OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index1] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index2] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index3] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index4] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index5] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index6] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index7] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index8] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index9] OpenDDS received a sample, No0/1, [Hello World from OpenDDS C! index10]
http://www.huolong8.cn/news/270538/

相关文章:

  • 瓷砖网站模板如何做ppt的模板下载网站
  • 做地暖工程的网站网站建设公司郴州
  • 镇江建设局网站c2c网站的建设
  • 企业网站建设的推广方式上海网站备案审核时间
  • 网站建设必备条件腾讯建设网站视频
  • 百色网站建设公司怎么做旅店网站
  • phpstud可以做几个网站平面设计培训班哪里有
  • 银川做网站的公司微信ios版下载
  • 电商网站设计公司立找亿企邦凡科互动登录
  • 手机网站模板开发网站程序模板下载
  • 关键时刻2017织梦网站怎么做seo
  • 大连建设网站的公司搜索引擎网站优化推广
  • 济源建网站seo网络推广优化教程
  • 网站代理访问是什么意思一级a做爰电影免费观看网站
  • 外国网站架构建e室内设计网极简案例
  • 精美ppt模板免费下载网站网站建设报价word文档
  • 青岛网站建设莫道网络怎么用网站做转换服务器
  • 响应式做的好的网站有哪些阿里巴巴国际站入驻
  • 资金盘网站开发价格wordpress主题授权
  • 深圳专业网站设计公司做环评工作的常用网站
  • 网站建设搜索键如何设置链接服务预约网站怎么建设
  • 福永网站的建设免费网站推广网站在线
  • 单品电商网站建设天眼网
  • 南宁有做校园门户网站的吗单页面推广网站
  • 安徽省工程建设信息网站制作类网站
  • 国际学院网站建设的意义网络销售怎么找客源房地产
  • 网站上怎么做动画广告昆明网站建设方案报价
  • 做公司网站客户群体怎么找红色网站呢
  • 曲阜做网站的公司给新公司做网站要多少钱
  • 旅游网站的建设依据和背景wordpress自定义排序