[openrtm-commit:00298] r514 - branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 8月 3日 (水) 13:33:11 JST
Author: fsi-katami
Date: 2011-08-03 13:33:10 +0900 (Wed, 03 Aug 2011)
New Revision: 514
Modified:
branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
Log:
Changed the type name of the data port to IFR ID. refs #1458
Modified: branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
===================================================================
--- branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2011-08-03 01:52:55 UTC (rev 513)
+++ branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2011-08-03 04:33:10 UTC (rev 514)
@@ -1,6 +1,7 @@
package jp.go.aist.rtm.RTC.port;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import jp.go.aist.rtm.RTC.buffer.BufferBase;
import jp.go.aist.rtm.RTC.buffer.RingBuffer;
@@ -36,12 +37,36 @@
* @return TypeCdoe(String)
*/
private static <DataType> String toTypeCode(DataRef<DataType> value) {
-// DataType data = value.v;
String typeName = value.v.getClass().getSimpleName();
return typeName;
}
/**
+ * <p> toRepositoryId </p>
+ * <p> This function gets IFR ID of data. </p>
+ *
+ * @param value data
+ * @return TypeCdoe(String)
+ */
+ private static <DataType> String toRepositoryId(DataRef<DataType> value){
+ String id = new String();
+ Class cl = value.v.getClass();
+ String str = cl.getName();
+ try {
+ Class helper = Class.forName(str+"Helper");
+
+ Method method = helper.getMethod("id");
+ id = (String)method.invoke(
+ null // invoke static method.
+ );
+ }
+ catch(java.lang.Exception e){
+// rtcout.println(Logbuf.WARN,
+// "Exception caught."+e.toString());
+ }
+ return id;
+ }
+ /**
* <p> read_stream </p>
* <p> This function reads data from InputStream. </p>
*
@@ -83,7 +108,8 @@
boolean read_block, boolean write_block,
long read_timeout, long write_timeout) {
- super(name, toTypeCode(value));
+ super(name,toRepositoryId(value));
+ //super(name, toTypeCode(value));
this.m_name = name;
this.m_value = value;
Modified: branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
===================================================================
--- branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2011-08-03 01:52:55 UTC (rev 513)
+++ branches/work/ToIFR_ID/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2011-08-03 04:33:10 UTC (rev 514)
@@ -1,6 +1,8 @@
package jp.go.aist.rtm.RTC.port;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
import java.util.Vector;
import jp.go.aist.rtm.RTC.buffer.BufferBase;
@@ -40,6 +42,31 @@
}
/**
+ * <p> toRepositoryId </p>
+ * <p> This function gets IFR ID of data. </p>
+ *
+ * @param value data
+ * @return TypeCdoe(String)
+ */
+ private static <DataType> String toRepositoryId(DataRef<DataType> value){
+ String id = new String();
+ Class cl = value.v.getClass();
+ String str = cl.getName();
+ try {
+ Class helper = Class.forName(str+"Helper");
+
+ Method method = helper.getMethod("id");
+ id = (String)method.invoke(
+ null // invoke static method.
+ );
+ }
+ catch(java.lang.Exception e){
+// rtcout.println(Logbuf.WARN,
+// "Exception caught."+e.toString());
+ }
+ return id;
+ }
+ /**
* {@.ja OutputStreamに整列化する}
* {@.en Marshals to ostream the data.}
*
@@ -191,7 +218,7 @@
public OutPort(BufferBase<DataType> buffer,
final String name, DataRef<DataType> valueRef) {
- super(name,toTypeCode(valueRef));
+ super(name,toRepositoryId(valueRef));
this.m_value = valueRef;
this.m_timeoutTick = 1000; // [usec]
openrtm-commit メーリングリストの案内