[openrtm-commit:02664] r960 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 7月 6日 (木) 17:42:18 JST
Author: t-katami
Date: 2017-07-06 17:42:18 +0900 (Thu, 06 Jul 2017)
New Revision: 960
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
Log:
[compat,->RELENG_1_2] Implemented duplicate connections. refs #4117
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java 2017-07-05 06:24:29 UTC (rev 959)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java 2017-07-06 08:42:18 UTC (rev 960)
@@ -548,7 +548,53 @@
}
return super.connect(connector_profile);
}
+ /**
+ * {@.ja [CORBA interface] Port の接続通知を行う}
+ * {@.en [CORBA interface] Notify the Ports connection}
+ *
+ * @param connector_profile
+ * {@.ja ConnectorProfileHolder}
+ * {@.en ConnectorProfileHolder}
+ * @return
+ * {@.ja ReturnCode_t 型のリターンコード}
+ * {@.en ReturnCode_t The return code of ReturnCode_t type.}
+ */
+ public ReturnCode_t
+ notify_connect(ConnectorProfileHolder connector_profile) {
+ Properties prop = new Properties();
+ NVListHolder nvholder =
+ new NVListHolder(connector_profile.value.properties);
+ NVUtil.copyToProperties(prop, nvholder);
+
+ String _str = m_properties.getProperty("dataport.fan_in");
+ int _type = 100;
+ try {
+ _type = Integer.parseInt(_str);
+ }
+ catch(Exception ex){
+ rtcout.println(Logbuf.ERROR,
+ "invalid connection_limit value: "+_str );
+ }
+
+ _str = prop.getProperty("dataport.fan_in");
+ try {
+ _type = Integer.parseInt(_str);
+ }
+ catch(Exception ex){
+ rtcout.println(Logbuf.ERROR,
+ "invalid connection_limit value: "+_str );
+ }
+
+ int value = _type;
+
+ if(value <= m_connectors.size()) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+
+ return super.notify_connect(connector_profile);
+ }
+
/**
* {@.ja Interface情報を公開する}
* {@.en Publish interface information}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-07-05 06:24:29 UTC (rev 959)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-07-06 08:42:18 UTC (rev 960)
@@ -540,7 +540,55 @@
return super.connect(connector_profile);
}
+
/**
+ * {@.ja [CORBA interface] Port の接続通知を行う}
+ * {@.en [CORBA interface] Notify the Ports connection}
+ *
+ * @param connector_profile
+ * {@.ja ConnectorProfileHolder}
+ * {@.en ConnectorProfileHolder}
+ * @return
+ * {@.ja ReturnCode_t 型のリターンコード}
+ * {@.en ReturnCode_t The return code of ReturnCode_t type.}
+ */
+ public ReturnCode_t
+ notify_connect(ConnectorProfileHolder connector_profile) {
+
+ Properties prop = new Properties();
+ NVListHolder nvholder =
+ new NVListHolder(connector_profile.value.properties);
+ NVUtil.copyToProperties(prop, nvholder);
+
+ String _str = m_properties.getProperty("dataport.fan_out");
+ int _type = 100;
+ try {
+ _type = Integer.parseInt(_str);
+ }
+ catch(Exception ex){
+ rtcout.println(Logbuf.ERROR,
+ "invalid connection_limit value: "+_str );
+ }
+
+ _str = prop.getProperty("dataport.fan_out");
+ try {
+ _type = Integer.parseInt(_str);
+ }
+ catch(Exception ex){
+ rtcout.println(Logbuf.ERROR,
+ "invalid connection_limit value: "+_str );
+ }
+
+ int value = _type;
+
+ if(value <= m_connectors.size()) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+
+ return super.notify_connect(connector_profile);
+ }
+
+ /**
* {@.ja Interface 情報を公開する}
* {@.en Publish interface information}
*
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-07-05 06:24:29 UTC (rev 959)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-07-06 08:42:18 UTC (rev 960)
@@ -6,12 +6,15 @@
import jp.go.aist.rtm.RTC.log.Logbuf;
import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
+import jp.go.aist.rtm.RTC.util.CORBA_RTCUtil;
import jp.go.aist.rtm.RTC.util.ConnectorProfileFactory;
import jp.go.aist.rtm.RTC.util.NVUtil;
import jp.go.aist.rtm.RTC.util.POAUtil;
import jp.go.aist.rtm.RTC.util.PortProfileFactory;
+import jp.go.aist.rtm.RTC.util.Properties;
import jp.go.aist.rtm.RTC.util.equalFunctor;
import jp.go.aist.rtm.RTC.util.operatorFunc;
+import jp.go.aist.rtm.RTC.util.StringUtil;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.TCKind;
@@ -582,7 +585,7 @@
synchronized (m_profile_mutex) {
if (isExistingConnId(connector_profile.value.connector_id)) {
rtcout.println(Logbuf.ERROR, "Connection already exists.");
- return ReturnCode_t.PRECONDITION_NOT_MET;
+ return ReturnCode_t.PRECONDITION_NOT_MET;
}
}
}
@@ -723,6 +726,34 @@
rtcout.println(Logbuf.TRACE, "notify_connect()");
+
+ Properties prop = new Properties();
+ NVListHolder nvholder =
+ new NVListHolder(this.m_profile.properties);
+ NVUtil.copyToProperties(prop, nvholder);
+ boolean default_value = StringUtil.toBool(
+ prop.getProperty("dataport.allow_dup_connection"),
+ "YES", "NO", false);
+
+ prop = new Properties();
+ nvholder =
+ new NVListHolder(connector_profile.value.properties);
+ NVUtil.copyToProperties(prop, nvholder);
+ if (!StringUtil.toBool(
+ prop.getProperty("dataport.allow_dup_connection"),
+ "YES","NO",default_value)){
+ for(int ic=0;ic<connector_profile.value.ports.length;++ic){
+ RTC.PortService port = connector_profile.value.ports[ic];
+ if(port._is_equivalent(m_objref)){
+ boolean ret = CORBA_RTCUtil.already_connected(port,
+ m_objref);
+ if(ret){
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ }
+ }
+ }
+
synchronized (m_connectorsMutex){
ReturnCode_t[] retval = {ReturnCode_t.RTC_OK, ReturnCode_t.RTC_OK,
ReturnCode_t.RTC_OK};
More information about the openrtm-commit
mailing list