[openrtm-commit:02313] r2885 - branches/FSM4RTC/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 1月 22日 (日) 23:00:28 JST
Author: n-ando
Date: 2017-01-22 23:00:28 +0900 (Sun, 22 Jan 2017)
New Revision: 2885
Modified:
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.h
Log:
[FSM4RTC,incompat] getEndpoints() function has been added to obtain endpoints from objref . refs #3836
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp 2017-01-22 13:59:14 UTC (rev 2884)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp 2017-01-22 14:00:28 UTC (rev 2885)
@@ -5,7 +5,7 @@
* @date $Date: 2007-12-31 03:06:24 $
* @author Noriaki Ando <n-ando at aist.go.jp>
*
- * Copyright (C) 2010
+ * Copyright (C) 2010-2016
* Intelligent Systems Research Institute,
* National Institute of
* Advanced Industrial Science and Technology (AIST), Japan
@@ -253,24 +253,20 @@
<< (int) pBody.version.minor << " ";
retstr << (const char*) pBody.address.host
<< " " << pBody.address.port << std::endl;
-
+
print_omni_key(retstr, pBody.object_key);
print_key(retstr, pBody.object_key);
print_tagged_components(retstr, pBody.components);
-
retstr << std::endl;
}
else if (ior.profiles[count].tag == IOP::TAG_MULTIPLE_COMPONENTS)
{
-
retstr << "Multiple Component Profile ";
IIOP::ProfileBody pBody;
IIOP::unmarshalMultiComponentProfile(ior.profiles[count],
pBody.components);
print_tagged_components(retstr, pBody.components);
-
retstr << std::endl;
-
}
else
{
@@ -287,8 +283,67 @@
return retstr.str();
}
+ std::vector<IIOP::Address> getEndpoints(IOP::IOR& ior)
+ {
+ std::vector<IIOP::Address> addr;
+#ifndef ORB_IS_RTORB
+ if (ior.profiles.length() == 0 && strlen(ior.type_id) == 0)
+ {
+ std::cerr << "IOR is a nil object reference." << std::endl;
+ return addr;
+ }
+ for (CORBA::ULong i(0); i < ior.profiles.length(); ++i)
+ {
+ if (ior.profiles[i].tag == IOP::TAG_INTERNET_IOP)
+ {
+ IIOP::ProfileBody pBody;
+ IIOP::unmarshalProfile(ior.profiles[i], pBody);
+ addr.push_back(pBody.address);
+ extractAddrs(pBody.components, addr);
+ }
+ else if (ior.profiles[i].tag == IOP::TAG_MULTIPLE_COMPONENTS)
+ {
+ IIOP::ProfileBody pBody;
+ IIOP::unmarshalMultiComponentProfile(ior.profiles[i],
+ pBody.components);
+ extractAddrs(pBody.components, addr);
+ }
+ else
+ {
+ std::cerr << "Unrecognised profile tag: 0x"
+ << std::hex << (unsigned)(ior.profiles[i].tag)
+ << std::dec << std::endl;
+ }
+ }
+#else // ORB_IS_RTORB
+ retstr << "RtORB does't support formatIORinfo() function." << std::endl;
+#endif // ORB_IS_RTORB
+ return addr;
+ }
+
+ void extractAddrs(IOP::MultipleComponentProfile& comp,
+ std::vector<IIOP::Address>& addr)
+ {
#ifndef ORB_IS_RTORB
+ for (CORBA::ULong i(0); i < comp.length(); ++i)
+ {
+ if (comp[i].tag == IOP::TAG_ALTERNATE_IIOP_ADDRESS)
+ {
+ cdrEncapsulationStream e(comp[i].component_data.get_buffer(),
+ comp[i].component_data.length(), 1);
+ IIOP::Address v;
+ v.host = e.unmarshalRawString();
+ v.port <<= e;
+ addr.push_back(v);
+ }
+ }
+#else // ORB_IS_RTORB
+#endif // ORB_IS_RTORB
+ return;
+ }
+
+#ifndef ORB_IS_RTORB
//------------------------------------------------------------
// static functions
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.h 2017-01-22 13:59:14 UTC (rev 2884)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.h 2017-01-22 14:00:28 UTC (rev 2885)
@@ -77,5 +77,11 @@
*/
std::string formatIORinfo(const char* iorstr);
+ std::vector<IIOP::Address> getEndpoints(IOP::IOR& ior);
+
+ void extractAddrs(IOP::MultipleComponentProfile& components,
+ std::vector<IIOP::Address>& addr);
+
+
}; // namespace CORBA_IORUtil
#endif // CORBA_IORUTIL_H
More information about the openrtm-commit
mailing list