[openrtm-commit:03341] r3419 - trunk/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 10月 9日 (火) 09:24:33 JST
Author: miyamoto
Date: 2018-10-09 09:24:33 +0900 (Tue, 09 Oct 2018)
New Revision: 3419
Modified:
trunk/OpenRTM-aist/src/lib/rtm/CORBA_RTCUtil.cpp
trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
Log:
[compat, bugfix] fixed bug.
Modified: trunk/OpenRTM-aist/src/lib/rtm/CORBA_RTCUtil.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/CORBA_RTCUtil.cpp 2018-10-09 00:01:37 UTC (rev 3418)
+++ trunk/OpenRTM-aist/src/lib/rtm/CORBA_RTCUtil.cpp 2018-10-09 00:24:33 UTC (rev 3419)
@@ -805,9 +805,18 @@
std::string prof_name;
conn_prof->name = CORBA::string_dup(name.c_str());
conn_prof->connector_id = CORBA::string_dup("");
- conn_prof->ports.length(2);
- conn_prof->ports[0] = RTC::PortService::_duplicate(port0);
- conn_prof->ports[1] = RTC::PortService::_duplicate(port1);
+ if (CORBA::is_nil(port1))
+ {
+ conn_prof->ports.length(1);
+ conn_prof->ports[0] = RTC::PortService::_duplicate(port0);
+ }
+ else
+ {
+ conn_prof->ports.length(2);
+ conn_prof->ports[0] = RTC::PortService::_duplicate(port0);
+ conn_prof->ports[1] = RTC::PortService::_duplicate(port1);
+ }
+
if (prop["dataport.dataflow_type"].empty())
{
prop["dataport.dataflow_type"] = "push";
@@ -873,8 +882,10 @@
const RTC::PortService_ptr port1)
{
if (CORBA::is_nil(port0)) { return RTC::BAD_PARAMETER; }
- if (CORBA::is_nil(port1)) { return RTC::BAD_PARAMETER; }
- if (port0->_is_equivalent(port1)) { return RTC::BAD_PARAMETER; }
+ if (!CORBA::is_nil(port1)) {
+ if (port0->_is_equivalent(port1)) { return RTC::BAD_PARAMETER; }
+ }
+
RTC::ConnectorProfile_var cprof;
cprof = create_connector(name, prop, port0, port1);
return port0->connect(cprof);
Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-10-09 00:01:37 UTC (rev 3418)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2018-10-09 00:24:33 UTC (rev 3419)
@@ -2630,8 +2630,10 @@
}
std::string tmp = param_itr->first;
coil::replaceString(tmp, "port", "");
+ std::string::size_type pos = param_itr->first.find("port");
+
int val = 0;
- if (coil::stringTo<int>(val, tmp.c_str()))
+ if (coil::stringTo<int>(val, tmp.c_str()) && pos != std::string::npos)
{
ports.push_back(param_itr->second);
continue;
@@ -2640,7 +2642,7 @@
}
-
+ /*
if (ports.size() == 0)
{
RTC_ERROR(("Invalid format for pre-connection."));
@@ -2647,6 +2649,7 @@
RTC_ERROR(("Format must be Comp0.port0?port=Comp1.port1"));
continue;
}
+ */
if (configs.count("dataflow_type") == 0)
{
@@ -2699,6 +2702,25 @@
continue;
}
+ if (ports.size() == 0)
+ {
+ coil::Properties prop;
+
+ for (coil::mapstring::iterator config_itr = configs.begin(); config_itr != configs.end(); ++config_itr) {
+ std::string key = config_itr->first;
+ std::string value = config_itr->second;
+ coil::eraseBothEndsBlank(key);
+ coil::eraseBothEndsBlank(value);
+
+ prop["dataport." + key] = value;
+ }
+
+ if (RTC::RTC_OK != CORBA_RTCUtil::connect(connectors[i], prop, port0_var, RTC::PortService::_nil()))
+ {
+ RTC_ERROR(("Connection error: %s", connectors[i].c_str()));
+ }
+ }
+
for (coil::vstring::iterator port_itr = ports.begin(); port_itr != ports.end(); ++port_itr)
{
openrtm-commit メーリングリストの案内