[openrtm-commit:00327] r533 - in trunk: . jp.go.aist.rtm.RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 8月 9日 (火) 14:29:07 JST


Author: fsi-katami
Date: 2011-08-09 14:29:07 +0900 (Tue, 09 Aug 2011)
New Revision: 533

Modified:
   trunk/
   trunk/jp.go.aist.rtm.RTC/
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListener.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerArgument.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerHolder.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListeners.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListener.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerArgument.java
   trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerHolder.java
Log:
Implemented of PortConnect listener.  refs #2048


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/RELENG_1_0_0:60-401
/branches/work/ForComponentActionListener:521-522
/branches/work/ForLogFormat:518-519
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/ToIFR_ID:509-514
   + /branches/RELENG_1_0_0:60-401
/branches/work/ForComponentActionListener:521-522
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/ToIFR_ID:509-514


Property changes on: trunk/jp.go.aist.rtm.RTC
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
   + /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -36,6 +36,7 @@
 import OpenRTM.DataFlowComponentHelper;
 import OpenRTM.DataFlowComponentPOA;
 import RTC.ComponentProfile;
+import RTC.ConnectorProfile;
 import RTC.ExecutionContext;
 import RTC.ExecutionContextHelper;
 import RTC.ExecutionContextListHolder;
@@ -2674,6 +2675,7 @@
         rtcout.println(Logbuf.TRACE, "addPort(PortBase)");
 
         port.setOwner(this.getObjRef());
+        port.setPortConnectListenerHolder(m_portconnListeners);
         onAddPort(port.getPortProfile());
 
         return m_portAdmin.addPort(port);
@@ -4960,10 +4962,7 @@
      */
     public void addPortConnectListener(int listener_type,
                                            PortConnectListener listener) {
-        if(listener_type < PortConnectListenerType.PORT_CONNECT_LISTENER_NUM){
-            m_portconnListeners.
-                portconnect_[listener_type].addObserver(listener);
-        }
+       addPortConnectListener(listener_type, listener, true);
     } 
 
     /**
@@ -5026,37 +5025,96 @@
                 portconnect_[listener_type].addObserver(listener);
         }
     }
-/*
-    template <class Listener>
-    PortConnectListener*
-    addPortConnectListener(PortConnectListenerType listener_type,
-                           Listener& obj,
-                           void (Listener::*memfunc)(const char*,
-                                                     ConnectorProfile&))
-    {
-      class Noname
-        : public PortConnectListener
-      {
-      public:
-        Noname(Listener& obj,
-               void (Listener::*memfunc)(const char*, ConnectorProfile&))
-          : m_obj(obj), m_memfunc(memfunc)
-        {
-        }
-        void operator()(const char* portname, ConnectorProfile& cprofile)
-        {
-          (m_obj.*m_memfunc)(portname, cprofile);
-        }
-      private:
-        Listener& m_obj;
-        typedef void (Listener::*Memfunc)(const char*, ConnectorProfile&);
-        Memfunc m_memfunc;
-      };
-      Noname* listener(new Noname(obj, memfunc));
-      addPortConnectListener(listener_type, listener, true);
-      return listener;
+    /**
+     * {@.ja PortConnectListener リスナを追加する}
+     * {@.en Adding PortConnect type listener}
+     * <p>
+     * {@.ja Portの接続時や接続解除時に呼び出される各種リスナを設定する。
+     *
+     * 設定できるリスナのタイプとコールバックイベントは以下の通り
+     *
+     * - ON_NOTIFY_CONNECT: notify_connect() 関数内呼び出し直後
+     * - ON_NOTIFY_DISCONNECT: notify_disconnect() 呼び出し直後
+     * - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() 内のIF購読解除時
+     *
+     * リスナは PortConnectListener を継承し、以下のシグニチャを持つ
+     * operator() を実装している必要がある。
+     *
+     * PortConnectListener::operator()(const char*, ConnectorProfile)
+     *
+     * デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+     * RTObjectに移り、RTObject解体時もしくは、
+     * removePortConnectListener() により削除時に自動的に解体される。
+     * リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+     * 数に false を指定し、自動的な解体を抑制することができる。}
+     * {@.en This operation adds certain listeners related to Port's connect 
+     * actions.
+     * The following listener types are available.
+     *
+     * - ON_NOTIFY_CONNECT: right after entering into notify_connect()
+     * - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect()
+     * - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect()
+     *
+     * Listeners should have the following function operator().
+     *
+     * PortConnectListener::operator()(const char*, ConnectorProfile)
+     *
+     * The ownership of the given listener object is transferred to
+     * this RTObject object in default.  The given listener object will
+     * be destroied automatically in the RTObject's dtor or if the
+     * listener is deleted by removePortConnectListener() function.
+     * If you want to keep ownership of the listener object, give
+     * "false" value to 3rd argument to inhibit automatic destruction.}
+     *
+     * @param listener_type 
+     *   {@.ja リスナタイプ}
+     *   {@.en A listener type}
+     * @param obj 
+     *   {@.ja リスナオブジェクト}
+     *   {@.en listener object}
+     * @param memfunc 
+     *   {@.ja リスナのmethod名}
+     *   {@.en Method name of listener}
+     *
+     */
+    public <DataType> 
+    PortConnectListener
+    addPortConnectListener(int listener_type,
+                                   DataType obj,
+                                   String memfunc) {
+        class Noname extends PortConnectListener {
+            public Noname(DataType obj, String memfunc) {
+                m_obj = obj;
+                try {
+                    Class clazz = m_obj.getClass();
+
+                    m_method = clazz.getMethod(memfunc,String.class,ConnectorProfile.class);
+
+                }
+                catch(java.lang.Exception e){
+                    System.out.println("Exception caught."+e.toString());
+                    rtcout.println(Logbuf.WARN, 
+                        "Exception caught."+e.toString());
+                }
+            }
+            public void operator(final String portname, ConnectorProfile profile) {
+                try {
+                    m_method.invoke(
+                          m_obj,
+                          portname,profile);
+                }
+                catch(java.lang.Exception e){
+                    rtcout.println(Logbuf.WARN, 
+                        "Exception caught."+e.toString());
+                }
+            }
+            private DataType m_obj;
+            private Method m_method;
+        };
+        Noname listener = new Noname(obj, memfunc);
+        addPortConnectListener(listener_type, listener, true);
+        return listener;
     }
-*/    
 
     /**
      * {@.ja PortConnectListener リスナを削除する}
@@ -5137,10 +5195,7 @@
      */
     public void addPortConnectRetListener(int listener_type,
                                            PortConnectRetListener listener) {
-        if(listener_type < PortConnectRetListenerType.PORT_CONNECT_RET_LISTENER_NUM){
-            m_portconnListeners.
-                portconnret_[listener_type].addObserver(listener);
-        }
+        addPortConnectRetListener(listener_type, listener, true);
     }
     /**
      * {@.ja PortConnectRetListener リスナを追加する}
@@ -5206,46 +5261,103 @@
                 portconnret_[listener_type].addObserver(listener);
         }
     }
-/*
-    template <class Listener>
-    PortConnectRetListener*
-    addPortConnectRetListener(PortConnectRetListenerType listener_type,
-                              Listener& obj,
-                              void (Listener::*memfunc)(const char*,
-                                                        ConnectorProfile&,
-                                                        ReturnCode_t))
-    {
-      class Noname
-        : public PortConnectRetListener
-      {
-      public:
-        Noname(Listener& obj,
-               void (Listener::*memfunc)(const char*,
-                                         ConnectorProfile&,
-                                         ReturnCode_t))
-          : m_obj(obj), m_memfunc(memfunc)
-        {
-        }
-        void operator()(const char* portname,
-                        ConnectorProfile& cprofile,
-                        ReturnCode_t ret)
-        {
-          (m_obj.*m_memfunc)(portname, cprofile, ret);
-        }
-      private:
-        Listener& m_obj;
-        typedef void (Listener::*Memfunc)(const char* portname,
-                                          ConnectorProfile& cprofile,
-                                          ReturnCode_t ret);
-        Memfunc m_memfunc;
-      };
-      Noname* listener(new Noname(obj, memfunc));
-      addPortConnectRetListener(listener_type, listener, true);
-      return listener;
-    }
-*/    
 
     /**
+     * {@.ja PortConnectRetListener リスナを追加する}
+     * {@.en Adding PortConnectRet type listener}
+     * <p>
+     * {@.ja Portの接続時や接続解除時に呼び出される各種リスナを設定する。
+     *
+     * 設定できるリスナのタイプとコールバックイベントは以下の通り
+     *
+     * - ON_CONNECT_NEXTPORT: notify_connect() 中のカスケード呼び出し直後
+     * - ON_SUBSCRIBE_INTERFACES: notify_connect() 中のインターフェース購読直後
+     * - ON_CONNECTED: nofity_connect() 接続処理完了時に呼び出される
+     * - ON_DISCONNECT_NEXT: notify_disconnect() 中にカスケード呼び出し直後
+     * - ON_DISCONNECTED: notify_disconnect() リターン時
+     *
+     * リスナは PortConnectRetListener を継承し、以下のシグニチャを持つ
+     * operator() を実装している必要がある。
+     *
+     * PortConnectRetListener::operator()(const char*, ConnectorProfile)
+     *
+     * デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+     * RTObjectに移り、RTObject解体時もしくは、
+     * removePortConnectRetListener() により削除時に自動的に解体される。
+     * リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+     * 数に false を指定し、自動的な解体を抑制することができる。}
+     * {@.en This operation adds certain listeners related to Port's connect 
+     * actions.
+     * The following listener types are available.
+     *
+     * - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect()
+     * - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect()
+     * - ON_CONNECTED: completed nofity_connect() connection process
+     * - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect()
+     * - ON_DISCONNECTED: completed notify_disconnect() disconnection process
+     *
+     * Listeners should have the following function operator().
+     *
+     * PortConnectRetListener::operator()(const char*, ConnectorProfile)
+     *
+     * The ownership of the given listener object is transferred to
+     * this RTObject object in default.  The given listener object will
+     * be destroied automatically in the RTObject's dtor or if the
+     * listener is deleted by removePortConnectRetListener() function.
+     * If you want to keep ownership of the listener object, give
+     * "false" value to 3rd argument to inhibit automatic destruction.}
+     *
+     * @param listener_type 
+     *   {@.ja リスナタイプ}
+     *   {@.en A listener type}
+     * @param obj 
+     *   {@.ja リスナオブジェクト}
+     *   {@.en listener object}
+     * @param memfunc 
+     *   {@.ja リスナのmethod名}
+     *   {@.en Method name of listener}
+     *
+     */
+    public <DataType> 
+    PortConnectRetListener
+    addPortConnectRetListener(int listener_type,
+                                   DataType obj,
+                                   String memfunc) {
+        class Noname extends PortConnectRetListener {
+            public Noname(DataType obj, String memfunc) {
+                m_obj = obj;
+                try {
+                    Class clazz = m_obj.getClass();
+
+                    m_method = clazz.getMethod(memfunc,String.class,ConnectorProfile.class,ReturnCode_t.class);
+
+                }
+                catch(java.lang.Exception e){
+                    rtcout.println(Logbuf.WARN, 
+                        "Exception caught."+e.toString());
+                }
+            }
+            public void operator(final String portname,
+                            ConnectorProfile profile,
+                            ReturnCode_t ret) {
+                try {
+                    m_method.invoke(
+                          m_obj,
+                          portname,profile,ret);
+                }
+                catch(java.lang.Exception e){
+                    rtcout.println(Logbuf.WARN, 
+                        "Exception caught."+e.toString());
+                }
+            }
+            private DataType m_obj;
+            private Method m_method;
+        };
+        Noname listener = new Noname(obj, memfunc);
+        addPortConnectRetListener(listener_type, listener, true);
+        return listener;
+    }
+    /**
      * {@.ja PortConnectRetListener リスナを削除する}
      * {@.en Removing PortConnectRet type listener}
      * <p>
@@ -6018,7 +6130,7 @@
      * {@.en Holders of PortConnectListeners}
      *
      */
-    protected PortConnectListeners m_portconnListeners;
+    protected PortConnectListeners m_portconnListeners = new PortConnectListeners();
 
     /**
      * {@.ja RTコンポーネント検索用ヘルパークラス}

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -725,6 +725,9 @@
         synchronized (m_connectorsMutex){
             ReturnCode_t[] retval = {ReturnCode_t.RTC_OK, ReturnCode_t.RTC_OK, 
                                  ReturnCode_t.RTC_OK}; 
+
+            onNotifyConnect(getName(), connector_profile.value);
+
             //
             // publish owned interface information to the ConnectorProfile
             retval[0] = publishInterfaces(connector_profile);
@@ -732,6 +735,7 @@
                 rtcout.println(Logbuf.ERROR, 
                            "publishInterfaces() in notify_connect() failed.");
             }
+            onPublishInterfaces(getName(), connector_profile.value, retval[0]);
             if (m_onPublishInterfaces != null) {
                 m_onPublishInterfaces.run(connector_profile);
             }
@@ -743,6 +747,7 @@
                 rtcout.println(Logbuf.ERROR, 
                                "connectNext() in notify_connect() failed.");
             }
+            onConnectNextport(getName(), connector_profile.value, retval[1]);
 
             // subscribe interface from the ConnectorProfile's information
             if (m_onSubscribeInterfaces != null) {
@@ -754,6 +759,7 @@
                 rtcout.println(Logbuf.ERROR, 
                            "subscribeInterfaces() in notify_connect() failed.");
             }
+            onSubscribeInterfaces(getName(), connector_profile.value, retval[2]);
 
             rtcout.println(Logbuf.PARANOID, 
                 m_profile.connector_profiles.length
@@ -782,6 +788,7 @@
 
             for (int i=0, len=retval.length; i < len; ++i) {
                 if (! ReturnCode_t.RTC_OK.equals(retval[i])) {
+                    onConnected(getName(), connector_profile.value, retval[i]);
                     return retval[i];
                 }
             }
@@ -790,6 +797,7 @@
             if (m_onConnected != null) {
                 m_onConnected.run(connector_profile);
             }
+            onConnected(getName(), connector_profile.value, ReturnCode_t.RTC_OK);
             return ReturnCode_t.RTC_OK;
         }
     }
@@ -1016,13 +1024,16 @@
 
                 ConnectorProfile prof 
                     = this.m_profile.connector_profiles[index];
+                onNotifyDisconnect(getName(), prof);
                 ReturnCode_t retval = disconnectNext(prof);
+                onDisconnectNextport(getName(), prof, retval);
                 if (m_onUnsubscribeInterfaces != null) {
                     ConnectorProfileHolder holder 
                         = new ConnectorProfileHolder(prof);
                     m_onUnsubscribeInterfaces.run(holder);
                     prof = holder.value;
                 }
+                onUnsubscribeInterfaces(getName(), prof);
                 unsubscribeInterfaces(prof);
 
                 if (m_onDisconnected != null) {
@@ -1038,7 +1049,7 @@
 
                 CORBA_SeqUtil.erase(holder, index);
                 this.m_profile.connector_profiles = holder.value;
-        
+                onDisconnected(getName(), prof, retval);
                 return retval;
            }
         }
@@ -1354,6 +1365,24 @@
         m_onConnectionLost = on_connection_lost;
     }
 
+    /**
+     * {@.ja PortConnectListeners のホルダをセットする}
+     * {@.en Setting PortConnectListener holder}
+     * <p>
+     * {@.ja ポートの接続に関するリスナ群を保持するホルダクラスへのポインタを
+     * セットする。この関数は通常親のRTObjectから呼ばれ、RTObjectが持つ
+     * ホルダクラスへのポインタがセットされる。}
+     * {@.en This operation sets a functor that is called when connection
+     * of this port does lost. }
+     *
+     * @param portconnListeners 
+     *   {@.ja PortConnectListeners オブジェクトのポインタ}
+     *   {@.en a pointer to ConnectionCallback's subclasses}
+     *
+     */
+    public void setPortConnectListenerHolder(PortConnectListeners portconnListeners){
+        m_portconnListeners = portconnListeners;
+    }
 
     /**
      * <p>Interface情報を公開します。
@@ -2040,6 +2069,82 @@
         }
         return true;
     }
+
+    protected void onNotifyConnect(final String portname,
+                                ConnectorProfile profile) {
+        if (m_portconnListeners != null) {
+            m_portconnListeners.portconnect_[PortConnectListenerType.ON_NOTIFY_CONNECT].notify(portname, profile);
+        }
+    }
+
+    protected void onNotifyDisconnect(final String portname,
+                                   RTC.ConnectorProfile profile) {
+        if (m_portconnListeners != null) {
+            m_portconnListeners.portconnect_[PortConnectListenerType.ON_NOTIFY_DISCONNECT].notify(portname, profile);
+        }
+    }
+    protected void onUnsubscribeInterfaces(final String portname,
+                                        RTC.ConnectorProfile profile) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnect_[PortConnectListenerType.ON_UNSUBSCRIBE_INTERFACES].notify(portname, profile);
+        }
+    }
+
+    protected void onPublishInterfaces(final String portname,
+                                    RTC.ConnectorProfile profile,
+                                    ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_PUBLISH_INTERFACES].notify(portname, profile, ret);
+        }
+    }
+
+    protected void onConnectNextport(final String portname,
+                                  RTC.ConnectorProfile profile,
+                                  ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_CONNECT_NEXTPORT].notify(portname, profile, ret);
+        }
+    }
+
+    protected void onSubscribeInterfaces(final String portname,
+                                      RTC.ConnectorProfile profile,
+                                      ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_SUBSCRIBE_INTERFACES].notify(portname, profile, ret);
+        }
+    }
+
+    protected void onConnected(final String portname,
+                            RTC.ConnectorProfile profile,
+                            ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_CONNECTED].notify(portname, profile, ret);
+        }
+    }
+
+    protected void onDisconnectNextport(final String portname,
+                                 RTC.ConnectorProfile profile,
+                                 ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_DISCONNECT_NEXT].notify(portname, profile, ret);
+        }
+    }
+
+    protected void onDisconnected(final String portname,
+                               RTC.ConnectorProfile profile,
+                               ReturnCode_t ret) {
+      if (m_portconnListeners != null) {
+          m_portconnListeners.
+            portconnret_[PortConnectRetListenerType.ON_DISCONNECTED].notify(portname, profile, ret);
+        }
+    }
+
   
     /**
      * <p> Publish interface information </p>
@@ -2084,6 +2189,16 @@
     protected ConnectionCallback m_onDisconnected;
     protected ConnectionCallback m_onConnectionLost;
     /**
+     * {@.ja PortConnectListenerホルダ}
+     * {@.en PortConnectListener holder}
+     * <p>
+     * {@.ja  PortConnectListenrを保持するホルダ}
+     * {@.en Holders of PortConnectListeners}
+     *
+     */
+    //protected PortConnectListeners m_portconnListeners = new PortConnectListeners();
+    protected PortConnectListeners m_portconnListeners = null;
+    /**
      * <p> The maximum number of connections </p>
      */
     protected int m_connectionLimit;

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListener.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListener.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListener.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,5 +1,6 @@
 package jp.go.aist.rtm.RTC.port;
 
+import java.util.Observable;
 import java.util.Observer;
 
 import RTC.ConnectorProfile;
@@ -23,7 +24,10 @@
    *
    */
 public abstract class PortConnectListener  implements Observer{
-
+    public void update(Observable o, Object obj) {
+           PortConnectListenerArgument arg = (PortConnectListenerArgument)obj;
+           operator(arg.m_portname,arg.m_connector_profile);
+    }
     /**
      * {@.ja デストラクタ}
      * {@.en Destructor}

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerArgument.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerArgument.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerArgument.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,6 +1,6 @@
 package jp.go.aist.rtm.RTC.port;
 
-import RTC.ReturnCode_t;
+import RTC.ConnectorProfile;
   /**
    * {@.ja PortConnectListenerArgument クラス}
    * {@.en PortConnectListenerArgument class}
@@ -13,13 +13,13 @@
      * {@.en Constructor}
      *
      */
-    public PortConnectListenerArgument(final String config_set_name,
-                                              final String config_param_name){
-        m_config_set_name = config_set_name; 
-        m_config_param_name = config_param_name;
+    public PortConnectListenerArgument(final String portname,
+                                       final ConnectorProfile prof) {
+        m_portname = portname; 
+        m_connector_profile = prof;
     }
-    public String m_config_set_name; 
-    public String m_config_param_name;
+    public String m_portname; 
+    public ConnectorProfile m_connector_profile; 
 }
 
 

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerHolder.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerHolder.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListenerHolder.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,6 +1,8 @@
 package jp.go.aist.rtm.RTC.port;
 
 import java.util.Observable;
+
+import RTC.ConnectorProfile;
   /**
    * {@.ja PortConnectListener ホルダクラス}
    * {@.en PortConnectListener holder class}
@@ -11,10 +13,10 @@
    *
    */
 public class PortConnectListenerHolder extends Observable{
-    public void notify(final String config_set_name,final String config_param_name) {
+    public void notify(final String portname,final ConnectorProfile prof) {
         super.setChanged();
         PortConnectListenerArgument arg 
-            = new PortConnectListenerArgument(config_set_name,config_param_name);
+            = new PortConnectListenerArgument(portname,prof);
         super.notifyObservers(arg);
         super.clearChanged();
     }

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListeners.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListeners.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectListeners.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -23,5 +23,14 @@
      */
     public PortConnectRetListenerHolder[] portconnret_
     = new PortConnectRetListenerHolder[PortConnectRetListenerType.PORT_CONNECT_RET_LISTENER_NUM];
+
+    public PortConnectListeners() {
+       for(int ic=0;ic<PortConnectListenerType.PORT_CONNECT_LISTENER_NUM;++ic){
+          portconnect_[ic] = new PortConnectListenerHolder();
+       }
+       for(int ic=0;ic<PortConnectRetListenerType.PORT_CONNECT_RET_LISTENER_NUM;++ic){
+          portconnret_[ic] = new PortConnectRetListenerHolder();
+       }
+    }
   };
 

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListener.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListener.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListener.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,5 +1,6 @@
 package jp.go.aist.rtm.RTC.port;
 
+import java.util.Observable;
 import java.util.Observer;
 
 import RTC.ConnectorProfile;
@@ -29,7 +30,10 @@
    *
    */
 public abstract class PortConnectRetListener implements Observer{
-
+    public void update(Observable o, Object obj) {
+           PortConnectRetListenerArgument arg = (PortConnectRetListenerArgument)obj;
+           operator(arg.m_portname,arg.m_connector_profile,arg.m_return_t);
+    }
     /**
      * {@.ja デストラクタ}
      * {@.en Destructor}

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerArgument.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerArgument.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerArgument.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,5 +1,6 @@
 package jp.go.aist.rtm.RTC.port;
 
+import RTC.ConnectorProfile;
 import RTC.ReturnCode_t;
   /**
    * {@.ja PortConnectRetListenerArgument クラス}
@@ -13,13 +14,16 @@
      * {@.en Constructor}
      *
      */
-    public PortConnectRetListenerArgument(final String config_set_name,
-                                              final String config_param_name){
-        m_config_set_name = config_set_name; 
-        m_config_param_name = config_param_name;
+    public PortConnectRetListenerArgument(final String portname,
+                                          final RTC.ConnectorProfile prof,
+                                          final ReturnCode_t ret){
+        m_portname = portname; 
+        m_connector_profile = prof;
+        m_return_t = ret;
     }
-    public String m_config_set_name; 
-    public String m_config_param_name;
+    public String m_portname; 
+    public RTC.ConnectorProfile m_connector_profile; 
+    public ReturnCode_t m_return_t;
 }
 
 

Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerHolder.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerHolder.java	2011-08-09 05:22:39 UTC (rev 532)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortConnectRetListenerHolder.java	2011-08-09 05:29:07 UTC (rev 533)
@@ -1,6 +1,9 @@
 package jp.go.aist.rtm.RTC.port;
 
 import java.util.Observable;
+
+import RTC.ConnectorProfile;
+import RTC.ReturnCode_t;
   /**
    * {@.ja PortConnectRetListener ホルダクラス}
    * {@.en PortConnectRetListener holder class}
@@ -11,10 +14,10 @@
    *
    */
 public class PortConnectRetListenerHolder extends Observable{
-    public void notify(final String config_set_name,final String config_param_name) {
+    public void notify(final String portname,final ConnectorProfile prof, final ReturnCode_t ret) {
         super.setChanged();
         PortConnectRetListenerArgument arg 
-            = new PortConnectRetListenerArgument(config_set_name,config_param_name);
+            = new PortConnectRetListenerArgument(portname,prof,ret);
         super.notifyObservers(arg);
         super.clearChanged();
     }



openrtm-commit メーリングリストの案内