[openrtm-commit:01742] r764 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: RTMExamples/SimpleIO RTMExamples/SimpleService jp/go/aist/rtm/RTC jp/go/aist/rtm/RTC/port
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 2月 22日 (月) 17:53:10 JST
Author: win-ei
Date: 2016-02-22 17:53:10 +0900 (Mon, 22 Feb 2016)
New Revision: 764
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/rtc.conf
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryInit.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerHolder.java
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/InPortBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortConnector.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPullConnector.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPushConnector.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/OutPortConnector.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPullConnector.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPushConnector.java
Log:
Direct data put mode has been implemented as a new interface_type=direct. Callbacks have been implemented.
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/rtc.conf
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/rtc.conf 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/rtc.conf 2016-02-22 08:53:10 UTC (rev 764)
@@ -11,7 +11,7 @@
#manager.modules.preload: ConsoleOut
#manager.components.precreate: ConsoleOut
-#manager.components.preconnect: ConsoleIn0.out:ConsoleOut0.in(dataflow_type=push&interface_type=corba_cdr)
+#manager.components.preconnect: ConsoleIn0.out:ConsoleOut0.in(dataflow_type=push&interface_type=direct)
#manager.components.preactivation: ConsoleIn0, ConsoleOut0
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf 2016-02-22 08:53:10 UTC (rev 764)
@@ -1,6 +1,7 @@
corba.nameservers: localhost
naming.formats: %n.rtc
-logger.enable:NO
+logger.enable:YES
+logger.log_level:PARANOID
#manager.modules.load_path:./RTMExamples/SimpleIO
#manager.modules.preload: ConsoleOut
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryInit.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryInit.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryInit.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -9,6 +9,8 @@
import jp.go.aist.rtm.RTC.port.InPortCorbaCdrConsumer;
import jp.go.aist.rtm.RTC.port.OutPortCorbaCdrProvider;
import jp.go.aist.rtm.RTC.port.OutPortCorbaCdrConsumer;
+import jp.go.aist.rtm.RTC.port.InPortDirectProvider;
+import jp.go.aist.rtm.RTC.port.InPortDirectConsumer;
/**
* {@.ja Factory初期処理用クラス}
@@ -43,5 +45,7 @@
InPortCorbaCdrConsumer.InPortCorbaCdrConsumerInit();
OutPortCorbaCdrConsumer.OutPortCorbaCdrConsumerInit();
OutPortCorbaCdrProvider.OutPortCorbaCdrProviderInit();
+ InPortDirectProvider.InPortDirectProviderInit();
+ InPortDirectConsumer.InPortDirectConsumerInit();
}
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -540,12 +540,7 @@
nvholder.value = new NameValue[0];
}
- CORBA_SeqUtil.push_back(nvholder,
- NVUtil.newNVString("dataport.dataflow_type", "push"));
- CORBA_SeqUtil.push_back(nvholder,
- NVUtil.newNVString("dataport.interface_type","corba_cdr"));
-
if ( conn_prop.length == 2 ) {
String[] opt_props = conn_prop[1].split("\\&");
for (int o=0; o < opt_props.length; ++o) {
@@ -556,6 +551,17 @@
NVUtil.newNVString("dataport." + temp[0],temp[1]));
}
}
+ int index;
+ index = NVUtil.find_index(nvholder,"dataport.dataflow_type");
+ if(index<0) {
+ CORBA_SeqUtil.push_back(nvholder,
+ NVUtil.newNVString("dataport.dataflow_type", "push"));
+ }
+ index = NVUtil.find_index(nvholder,"dataport.interface_type");
+ if(index<0) {
+ CORBA_SeqUtil.push_back(nvholder,
+ NVUtil.newNVString("dataport.interface_type","corba_cdr"));
+ }
conn_prof.properties = nvholder.value;
ConnectorProfileHolder profileholder = new ConnectorProfileHolder();
@@ -565,6 +571,7 @@
rtcout.println(Logbuf.ERROR,
"Connection error: " + connectors[ic]);
}
+
NVUtil.dump(nvholder);
}
} // end of pre-connection
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -625,7 +625,7 @@
/**
* {@.ja コンポーネント管理用構造体}
- * {@,en Structure for component management}
+ * {@.en Structure for component management}
*/
protected class Port {
public Port(final String n, final PortBase p) {
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerHolder.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerHolder.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerHolder.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -2,6 +2,9 @@
import java.util.Observable;
+import jp.go.aist.rtm.RTC.util.DataRef;
+import jp.go.aist.rtm.RTC.log.Logbuf;
+
import org.omg.CORBA.portable.OutputStream;
/**
@@ -10,15 +13,30 @@
* <p> This class manages one ore more instances of ConnectorDataListener class. </p>
*
*/
-public class ConnectorDataListenerHolder extends Observable{
+public class ConnectorDataListenerHolder<DataType> extends Observable{
+ public ConnectorDataListenerHolder(){
+ rtcout = new Logbuf("ConnectorDataListenerHolder");
+ }
public void notify(final ConnectorBase.ConnectorInfo info,
final OutputStream cdrdata) {
super.setChanged();
- ConnectorDataListenerArgument arg
- = new ConnectorDataListenerArgument(info,cdrdata);
+ //ConnectorDataListenerArgument arg
+ // = new ConnectorDataListenerArgument(info,cdrdata);
+ ConnectorDataListenerArgumentDataRef<OutputStream> arg
+ = new ConnectorDataListenerArgumentDataRef<OutputStream>(info,cdrdata);
super.notifyObservers((Object)arg);
}
+ //public void notify(final ConnectorBase.ConnectorInfo info, final DataRef<DataType> data) {
+ public void notify(final ConnectorBase.ConnectorInfo info,
+ final DataType data) {
+ super.setChanged();
+ ConnectorDataListenerArgumentDataRef<DataType> arg
+ = new ConnectorDataListenerArgumentDataRef<DataType>(info,data);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+ protected Logbuf rtcout;
}
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 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/ConnectorDataListenerT.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -5,7 +5,9 @@
import java.util.Observer;
import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.OutputStream;
+import jp.go.aist.rtm.RTC.log.Logbuf;
/**
* {@.ja ConnectorDataListenerTクラス}
* {@.en ConnectorDataListenerT class}
@@ -25,6 +27,7 @@
*
*/
public ConnectorDataListenerT(Class<DataType> cl) {
+ rtcout = new Logbuf("ConnectorDataListenerT");
String class_name = cl.getName();
try {
Class datatype = Class.forName(class_name,
@@ -74,20 +77,31 @@
* {@.en Object}
*/
public void update(Observable o, Object obj) {
- ConnectorDataListenerArgument arg
- = (ConnectorDataListenerArgument)obj;
- try {
- m_streamable._read(arg.m_data.create_input_stream());
- m_datatype = (DataType)m_field.get(m_streamable);
+ //ConnectorDataListenerArgument arg
+ // = (ConnectorDataListenerArgument)obj;
+ ConnectorDataListenerArgumentDataRef<DataType> arg
+ = (ConnectorDataListenerArgumentDataRef<DataType>)obj;
+ String type = arg.m_info.properties.getProperty("interface_type");
+ //rtcout.println(Logbuf.TRACE, "interface_type:"+type);
+ if(type.equals("direct")) {
+ m_datatype = (DataType)arg.m_data;
}
- catch(IllegalAccessException e){
- //set throws
- e.printStackTrace();
+ else {
+ try {
+ //m_streamable._read(arg.m_data.create_input_stream());
+ OutputStream out_data = (OutputStream)arg.m_data;
+ m_streamable._read(out_data.create_input_stream());
+ m_datatype = (DataType)m_field.get(m_streamable);
+ }
+ catch(IllegalAccessException e){
+ //set throws
+ e.printStackTrace();
+ }
+ catch(IllegalArgumentException e){
+ //invoke throws
+ e.printStackTrace();
+ }
}
- catch(IllegalArgumentException e){
- //invoke throws
- e.printStackTrace();
- }
operator(arg.m_info,m_datatype);
}
/**
@@ -112,6 +126,7 @@
private Streamable m_streamable = null;
private Field m_field = null;
private DataType m_datatype = null;
+ protected Logbuf rtcout;
}
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 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -1168,7 +1168,7 @@
* {@.en OutPort consumer initialization}
*/
protected void initConsumers() {
- rtcout.println(Logbuf.TRACE, "iinitConsumers()");
+ rtcout.println(Logbuf.TRACE, "initConsumers()");
// create OuPort consumers
OutPortConsumerFactory<OutPortProvider,String> factory
@@ -1425,7 +1425,27 @@
}
}
}
+
/**
+ * {@.ja リスナホルダを取得する}
+ * {@.en Getting listeners holder}
+ *
+ * <p>
+ * {@.ja InPortBaseが保持するリスナホルダを返す。}
+ * {@.en This operation returns listeners holder.}
+ *
+ * @return
+ * {@.ja ConnectorListeners}
+ * {@.en ConnectorListeners}
+ *
+ */
+ public ConnectorListeners getListeners(){
+ return m_listeners;
+ }
+
+
+
+ /**
* {@.ja endian 設定を返す}
* {@.en Returns endian}
*
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -28,12 +28,14 @@
* {@.en A pointer to the buffer of the connector}
*/
public InPortConnector(ConnectorBase.ConnectorInfo profile,
+ ConnectorListeners listeners,
BufferBase<OutputStream> buffer) {
rtcout = new Logbuf("InPortConnector");
m_profile = profile;
m_buffer = buffer;
m_isLittleEndian = true;
m_orb = ORBUtil.getOrb();
+ m_listeners = listeners;
}
@@ -169,6 +171,12 @@
protected BufferBase<OutputStream> m_buffer;
protected boolean m_isLittleEndian;
protected org.omg.CORBA.ORB m_orb;
+ /**
+ * {@.ja ConnectorListenrs への参照}
+ * {@.en A reference to a ConnectorListener}
+ */
+ ConnectorListeners m_listeners;
+
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPullConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPullConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPullConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -98,7 +98,7 @@
OutPortConsumer consumer,
ConnectorListeners listeners,
BufferBase<OutputStream> buffer) throws Exception {
- super(profile, buffer);
+ super(profile, listeners, buffer);
m_consumer = consumer;
m_listeners = listeners;
rtcout = new Logbuf("InPortPullConnector");
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPushConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPushConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortPushConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -52,7 +52,7 @@
public InPortPushConnector(ConnectorInfo profile, InPortProvider provider,
ConnectorListeners listeners,
BufferBase<OutputStream> buffer) throws Exception {
- super(profile, buffer);
+ super(profile, listeners, buffer);
m_provider = provider;
m_listeners = listeners;
if (buffer == null ) {
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 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -1516,21 +1516,23 @@
"old compiler? new returned 0;");
return null;
}
- rtcout.println(Logbuf.TRACE, "OutPortPushConnector create");
+ rtcout.println(Logbuf.TRACE, "OutPortPushConnector created");
- rtcout.println(Logbuf.PARANOID, "direct_dataput.disable= " +
- prop.getProperty("direct_dataput.disable"));
- // set direct InPort if ConnectorProfile
- // .properties["dataport.outport.direct_dataput.disable"] != YES
- if (!StringUtil.toBool(
- prop.getProperty("direct_dataput.disable"),
- "YES", "NO", true)) {
+ String type = prop.getProperty("interface_type").trim();
+ rtcout.println(Logbuf.PARANOID, "interface_type= " + type);
+ // "interface_type" == "direct"
+ if (type.equals("direct")) {
InPortBase inport = getLocalInPort(profile);
- if (inport != null) {
- connector.setInPort(inport);
+ if (inport == null) {
+ rtcout.println(Logbuf.DEBUG,
+ "interface_type is direct, " +
+ "but a peer InPort servant could not be obtained.");
+ //delete connector;
+ return null;
}
+ connector.setInPort(inport);
}
- // end of direct port
+ // end of direct interface_type
m_connectors.add(connector);
rtcout.println(Logbuf.PARANOID,
@@ -1616,7 +1618,7 @@
catch (Exception e) {
rtcout.println(Logbuf.TRACE, "126: "+e);
rtcout.println(Logbuf.DEBUG,
- "Peer port is remote port.");
+ "Peer port might be a remote port.");
}
}
return null;
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -24,11 +24,13 @@
* {@.ja 接続情報を含む ConnectorInfo オブジェクト}
* {@.en ConnectorInfo object which includes connection information}
*/
- public OutPortConnector(ConnectorBase.ConnectorInfo profile) {
+ public OutPortConnector(ConnectorBase.ConnectorInfo profile,
+ ConnectorListeners listeners) {
rtcout = new Logbuf("OutPortConnector");
m_profile = profile;
m_isLittleEndian = true;
m_directInPort = null;
+ m_listeners = listeners;
}
/**
@@ -138,6 +140,7 @@
}
m_directInPort = directInPort;
+ m_inPortListeners = m_directInPort.getListeners();
return true;
}
@@ -155,6 +158,22 @@
protected Logbuf rtcout;
protected ConnectorInfo m_profile;
protected boolean m_isLittleEndian;
+ /**
+ * {@.ja 同一プロセス上のピアInPortのポインタ}
+ * {@.en InProt pointer to the peer in the same process}
+ */
protected InPortBase m_directInPort;
+ /**
+ * {@.ja ConnectorListenrs への参照}
+ * {@.en A reference to a ConnectorListener}
+ */
+ protected ConnectorListeners m_listeners = new ConnectorListeners();
+
+ /**
+ * {@.ja InPort 側の ConnectorListenrs への参照}
+ * {@.en A pointer to a InPort's ConnectorListener}
+ */
+ protected ConnectorListeners m_inPortListeners = new ConnectorListeners();
+
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPullConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPullConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPullConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -93,7 +93,7 @@
OutPortProvider provider,
ConnectorListeners listeners,
BufferBase<OutputStream> buffer) throws Exception {
- super(profile);
+ super(profile,listeners);
_constructor(profile, provider, listeners, buffer);
}
/**
@@ -131,7 +131,7 @@
public OutPortPullConnector(ConnectorInfo profile,
OutPortProvider provider,
ConnectorListeners listeners) throws Exception {
- super(profile);
+ super(profile,listeners);
BufferBase<OutputStream> buffer = null;
_constructor(profile, provider, listeners, buffer);
@@ -185,13 +185,55 @@
rtcout.println(Logbuf.TRACE, "write()");
if (m_directInPort != null) {
+ InPort inport = (InPort)m_directInPort;
+ if(inport.isNew()) {
+ // ON_BUFFER_OVERWRITE(In,Out), ON_RECEIVER_FULL(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVER_FULL].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVER_FULL].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ONBUFFER_OVERWRITE(InPort,OutPort), "
+ + "ON_RECEIVER_FULL(InPort,OutPort) "
+ + "callback called in direct mode.");
+
+ }
+
+ // ON_BUFFER_WRITE(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_WRITE].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_WRITE].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ON_BUFFER_WRITE(InPort,OutPort), "
+ + "callback called in direct mode.");
DataRef<DataType> dataref
= new DataRef<DataType>(data);
+ inport.write(dataref); // write to InPort variable!!
+ // ON_RECEIVED(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVED].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVED].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ON_RECEIVED(InPort,OutPort), "
+ + "callback called in direct mode.");
+ return ReturnCode.PORT_OK;
+
+/*
+ DataRef<DataType> dataref
+ = new DataRef<DataType>(data);
//static_cast<InPort<DataType>*>(m_directInPort).write(data);
((InPort)m_directInPort).write(dataref);
return ReturnCode.PORT_OK;
+*/
}
+ // normal case
OutPort out = (OutPort)m_outport;
OutputStream cdr
= new EncapsOutputStreamExt(m_orb,m_isLittleEndian);
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPushConnector.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPushConnector.java 2016-02-21 06:27:31 UTC (rev 763)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortPushConnector.java 2016-02-22 08:53:10 UTC (rev 764)
@@ -61,7 +61,7 @@
InPortConsumer consumer,
ConnectorListeners listeners,
BufferBase<OutputStream> buffer) throws Exception {
- super(profile);
+ super(profile,listeners);
try {
_Constructor(profile,consumer,listeners,buffer);
}
@@ -106,7 +106,7 @@
public OutPortPushConnector(ConnectorInfo profile,
ConnectorListeners listeners,
InPortConsumer consumer ) throws Exception {
- super(profile);
+ super(profile,listeners);
BufferBase<OutputStream> buffer = null;
try {
_Constructor(profile,consumer,listeners,buffer);
@@ -201,13 +201,54 @@
rtcout.println(Logbuf.TRACE, "write()");
if (m_directInPort != null) {
+ InPort inport = (InPort)m_directInPort;
+ if(inport.isNew()) {
+ // ON_BUFFER_OVERWRITE(In,Out), ON_RECEIVER_FULL(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVER_FULL].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVER_FULL].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ONBUFFER_OVERWRITE(InPort,OutPort), "
+ + "ON_RECEIVER_FULL(InPort,OutPort) "
+ + "callback called in direct mode.");
+
+ }
+ // ON_BUFFER_WRITE(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_WRITE].notify(m_profile, data);
+ m_inPortListeners .
+ connectorData_[ConnectorDataListenerType.ON_BUFFER_WRITE].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ON_BUFFER_WRITE(InPort,OutPort), "
+ + "callback called in direct mode.");
DataRef<DataType> dataref
= new DataRef<DataType>(data);
+ inport.write(dataref); // write to InPort variable!!
+ // ON_RECEIVED(In,Out) callback
+ m_listeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVED].notify(m_profile, data);
+ m_inPortListeners.
+ connectorData_[ConnectorDataListenerType.ON_RECEIVED].notify(m_profile, data);
+ rtcout.println(Logbuf.PARANOID,
+ "ON_RECEIVED(InPort,OutPort), "
+ + "callback called in direct mode.");
+ return ReturnCode.PORT_OK;
+
+/*
+ DataRef<DataType> dataref
+ = new DataRef<DataType>(data);
//static_cast<InPort<DataType>*>(m_directInPort).write(data);
((InPort)m_directInPort).write(dataref);
return ReturnCode.PORT_OK;
+*/
}
+ // normal case
OutPort out = (OutPort)m_outport;
OutputStream cdr
= new EncapsOutputStreamExt(m_orb,m_isLittleEndian);
More information about the openrtm-commit
mailing list