当前位置 : 主页 > 网络编程 > 其它编程 >

corba北向接口开发之数据类型解析

来源:互联网 收集:自由互联 发布时间:2023-07-02
corbavs2012TAO+ACEVC++程序大神请进,自己在有一个corba的项目:是关于corba北向接口的能够和厂家提供的设备的服务端(厂家设备向外提供接口,只需 corba vs2012 TAO+ACE VC++程序 大神请进,自己
corbavs2012TAO+ACEVC++程序大神请进,自己在有一个corba的项目:是关于corba北向接口的能够和厂家提供的设备的服务端(厂家设备向外提供接口,只需 corba vs2012 TAO+ACE VC++程序 大神请进,自己在有一个corba的项目:是关于corba北向接口的能够和厂家提供的设备的服务端(厂家设备向外提供接口,只需要开发一个客户端就可以和它进行数据交互)连接上并且可以返回查询的一些信息,但返回的数据类型根据厂家提供的文档不能够解析(厂家技术说他们没有做过关于vc++开发的,暂时提供不了解决的方案),求大神可以解析数据类型。 另:编译工具VS2012,TAO和ACE的编译工具是VS2013(下载的ACE、TAO版本比较高一点)。 这是厂家提供的数据类型: Conentoftherequest"push_structured_event": in:notification IDL:omg.org/CosNotification/StructuredEvent:1.0 { header:IDL:omg.org/CosNotification/EventHeader:1.0 { fixed_header:IDL:omg.org/CosNotification/FixedEventHeader:1.0 { event_type:IDL:omg.org/CosNotification/EventType:1.0 { domain_name:String:tmf_mtnm, type_name:String:NT_ALARM }, event_name:String:alarmRecordAutoReport }, variable_header:Sequence:Sequenceoflength:0() }, filterable_data:Sequence:Sequenceoflength:20( IDL:omg.org/CosNotification/Property:1.0 { name:String:notificationId, value:String:6 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:objectName, value:IDL:mtnm.tmforum.org/globaldefs/NamingAttributes_T:1.0:Sequenceoflength:2 ( IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:EMS, value:String:EMSName }; IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:ManagedElement, value:String:192.192.10.254 } ) }; IDL:omg.org/CosNotification/Property:1.0 { name:String:nativeEMSName, value:String:/EMS=EMSName/ManagedElement=192.192.10.254 }; IDL:omg.org/CosNotification/Property:1.0{ name:String:nativeProbableCause, value:String:NE_COMMU_BREAK }; IDL:omg.org/CosNotification/Property:1.0 { name:String:objectType, value:IDL:mtnm.tmforum.org/notifications/ObjectType_T:1.0:OT_MANAGED_ELEMENT }; IDL:omg.org/CosNotification/Property:1.0{ name:String:emsTime, value:String: }; IDL:omg.org/CosNotification/Property:1.0 { name:String:neTime, value:String:2013-11-2908:54:05 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:isClearable, value:String:1 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:layerRate, value:Short:0 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:probableCause, value:String:NE_COMMU_BREAK }; IDL:omg.org/CosNotification/Property:1.0 { name:String:probableCauseQualifier, value:String:NE_COMMU_BREAK }; IDL:omg.org/CosNotification/Property:1.0{ name:String:perceivedSeverity, value:IDL:mtnm.tmforum.org/notifications/PerceivedSeverity_T:1.0:PS_CRITICAL }; IDL:omg.org/CosNotification/Property:1.0{ name:String:serviceAffecting, value:IDL:mtnm.tmforum.org/notifications/ServiceAffecting_T:1.0:SA_UNKNOWN }; IDL:omg.org/CosNotification/Property:1.0{ name:String:affectedTPList, value:String: }; IDL:omg.org/CosNotification/Property:1.0{ name:String:additionalText, value:IDL:mtnm.tmforum.org/globaldefs/NVSList_T:1.0:Sequenceoflength:2 ( IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:REMARK, value:String: }; IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:AlmText, value:String:NE_COMMU_BREAK } ) }; IDL:omg.org/CosNotification/Property:1.0 { name:String:additionalInfo, value:IDL:mtnm.tmforum.org/globaldefs/NVSList_T:1.0:Sequenceoflength:2 ( IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:status, value:String:3 }; IDL:mtnm.tmforum.org/globaldefs/NameAndStringValue_T:1.0 { name:String:serverTime, value:String:2014-08-0811:15:44 } ) }; IDL:omg.org/CosNotification/Property:1.0 { name:String:EventType, value:String:COMMUNICATIONSALARM }; IDL:omg.org/CosNotification/Property:1.0 { name:String:acknowledgeIndication, value:String:1 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:CorrelatedNotifications, value:String:0 }; IDL:omg.org/CosNotification/Property:1.0 { name:String:objectNameText, value:String:/EMS=EMSName/ManagedElement=192.192.10.254 } ), remainder_of_body:null } 这是自己写的连接、查询、返回数据解析代码: intargc=2; char*argv[2]={0,0}; argv[0]="-ORBInitRef"; argv[1]="NameService=corbaloc::192.192.4.200:6350/NameService"; g_orb=CORBA::ORB_init(argc,argv); CORBA::Object_varnsobj=g_orb->resolve_initial_references("NameService"); CosNaming::NamingContext_varnamingContext=CosNaming::NamingContext::_narrow(nsobj.in()); if(CORBA::is_nil(namingContext.in())) { _debug_to(_T("oops,cannotaccesstheNamingServices!")); } CosNaming::Namepath; path.length(5); path[0].id=CORBA::string_dup("TMF_MTNM"); path[0].kind=CORBA::string_dup("class"); path[1].id=CORBA::string_dup("ATRIE"); path[1].kind=CORBA::string_dup("vendor"); path[2].id=CORBA::string_dup("ATRIE"); path[2].kind=CORBA::string_dup("EmsInstance"); path[3].id=CORBA::string_dup("2.1"); path[3].kind=CORBA::string_dup("Version"); path[4].id=CORBA::string_dup("EmsSessionFactory"); path[4].kind=CORBA::string_dup("EmsSessionFactory_I"); g_obj=namingContext->resolve(path); emsSessionFactory::EmsSessionFactory_I_varemsSessionFactory_I=emsSessionFactory::EmsSessionFactory_I::_narrow(g_obj); emsSession::EmsSession_I_varsessionHolder=emsSession::EmsSession_I::_narrow(g_obj); nmsSession::NmsSession_I_varpNmsSessionServant=nmsSession::NmsSession_I::_narrow(g_obj); emsSessionFactory_I->getEmsSession("nbif","Admin123",pNmsSessionServant,sessionHolder); emsSession::EmsSession_I*emsSession_I=sessionHolder._retn(); if(emsSession_I!=NULL) { common::Common_I_varcommon_IHolder=common::Common_I::_narrow(emsSession_I); emsSession_I->getManager("EmsMgr",common_IHolder); common::Common_I*common_I=common_IHolder._retn(); std::tstringLogStr=_T("EmsMgr信息:"); if(common_I!=NULL) { emsMgr::EMSMgr_I_varemsMgr_IHolder=emsMgr::EMSMgr_I::_narrow(common_I); emsMgr::EMSMgr_I*emsMgr_I=emsMgr_IHolder._retn(); if(emsMgr_I!=NULL) { notifications::ProbableCauseList_TProbList; notifications::PerceivedSeverityList_TSecList; unsignedlongcount=1000; notifications::EventList_T_varEventList; notifications::EventIterator_I_varEventIt; //查询所有EMS和网元的告警 emsMgr_I->getAllEMSAndMEActiveAlarms(ProbList,SecList,count,EventList,EventIt); CosNotification::StructuredEvent*m_pSEInfo=EventList->get_buffer(); //解析 intiEventLen=EventList->length();//长度36 if(m_pSEInfo!=NULL) { for(intiEventIndex=0;iEventIndex>=(TempStr); TAO::Any_Impl*m_impl=m_Info.impl(); TAO_OutputCDRm_outcdr; m_impl->marshal_value(m_outcdr); constchar*m_poutbuffer=m_outcdr.buffer(); intoutcdrlen=m_outcdr.length(); boolencodFlag=m_impl->encoded(); CORBA::TypeCode_ptrm_typeCode; m_typeCode=m_impl->type(); CORBA::TCKindstrtype=m_typeCode->kind(); CORBA::String_varm_typeid=m_typeCode->id(); CORBA::String_varm_typename=m_typeCode->name(); } } } } } } 主要是CORBA::Anym_any=m_pProInfo[bodyindex].value;CORBA::Any类型不好解析,我找了许多资料都不行,求大神提供一些方案,不胜感激。qq:897672428

6 个解决方案

#1

莫非楼主就是那位“最后一个CORBAer”!

#2

没有,公司项目需要,正好了解下,但是卡在这里了

#3

up~~~~~~~~~~~~~~~~~~~~~

#4

告诉你的头,换一个供应厂商吧! Corba不提供C++模式的。 而Corba没有流行起来就是他们是基于C的,太复杂了。

#5

我讨厌Corba是因为他们使用了一个不该她们使用的IDL。 早年我在网上搜索IDL总是他们的。 而我需要的是接口的定义语言。

#6

不,我只想把corba::any中的数据拿到,然后完成这个项目,发丝再也不会主动去看corba了 【文章原创作者:武汉网站制作公司 http://www.1234xp.com/wuhan.html 网络转载请说明出处】
上一篇:Qt将写入数组到bin文件
下一篇:没有了
网友评论