[openrtm-commit:02474] r954 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 21日 (火) 16:09:31 JST
Author: win-ei
Date: 2017-02-21 16:09:31 +0900 (Tue, 21 Feb 2017)
New Revision: 954
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerT.java
Log:
[FSM4RTC] Added the check of the type of the listener's argument. refs #3780
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerT.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerT.java 2017-02-21 01:40:41 UTC (rev 953)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerT.java 2017-02-21 07:09:31 UTC (rev 954)
@@ -1,6 +1,8 @@
package jp.go.aist.rtm.RTC.port;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import java.util.Observable;
import java.util.Observer;
@@ -11,6 +13,7 @@
import jp.go.aist.rtm.RTC.log.Logbuf;
import jp.go.aist.rtm.RTC.util.ORBUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
import RTC.ReturnCode_t;
@@ -45,11 +48,18 @@
this.getClass().getClassLoader());
m_streamable = (Streamable)holder.newInstance();
m_field = m_streamable.getClass().getField("value");
+ Class helper = Class.forName(class_name+"Helper");
+
+ Method method = helper.getMethod("id");
+ m_id = (String)method.invoke( null );
}
catch(NoSuchFieldException e){
//getField throws
e.printStackTrace();
}
+ catch(NoSuchMethodException e){
+ e.printStackTrace();
+ }
catch(java.lang.InstantiationException e){
e.printStackTrace();
}
@@ -65,6 +75,10 @@
//invoke throws
e.printStackTrace();
}
+ catch(InvocationTargetException e){
+ //invoke throws
+ e.printStackTrace();
+ }
}
/**
* {@.ja コールバックメソッド}
@@ -88,6 +102,11 @@
ConnectorDataListenerArgumentDataRef<DataType> arg
= (ConnectorDataListenerArgumentDataRef<DataType>)obj;
String type = arg.m_info.properties.getProperty("interface_type");
+
+ String data_type = arg.m_info.properties.getProperty("data_type");
+ if(!m_id.equals(data_type)) {
+ return;
+ }
//rtcout.println(Logbuf.TRACE, "interface_type:"+type);
if(type.equals("direct")) {
m_datatype = (DataType)arg.m_data;
@@ -172,6 +191,7 @@
private Field m_field = null;
private DataType m_datatype = null;
protected Logbuf rtcout;
+ protected String m_id;
}
openrtm-commit メーリングリストの案内