[openrtm-commit:02175] r884 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 12月 15日 (木) 08:16:12 JST
Author: win-ei
Date: 2016-12-15 08:16:12 +0900 (Thu, 15 Dec 2016)
New Revision: 884
Added:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmActionListeners.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListener.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerArgument.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerHolder.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerType.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListener.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerArgument.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerHolder.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerType.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListener.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerArgument.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerHolder.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerType.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListener.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerHolder.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerType.java
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
Log:
Implemented ComponentObserver interface.
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmActionListeners.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmActionListeners.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmActionListeners.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,37 @@
+package jp.go.aist.rtm.RTC;
+
+ /**
+ * {@.ja FsmActionListeners クラス}
+ * {@.en FsmActionListeners class}
+ */
+
+public class FsmActionListeners {
+ public PreFsmActionListenerHolder[] preaction_
+ = new PreFsmActionListenerHolder[PreFsmActionListenerType.PRE_FSM_ACTION_LISTENER_NUM];
+
+ public PostFsmActionListenerHolder[] postaction_
+ = new PostFsmActionListenerHolder[PostFsmActionListenerType.POST_FSM_ACTION_LISTENER_NUM];
+
+ public FsmProfileListenerHolder[] profile_
+ = new FsmProfileListenerHolder[FsmProfileListenerType.FSM_PROFILE_LISTENER_NUM];
+
+ public FsmStructureListenerHolder[] structure_
+ = new FsmStructureListenerHolder[FsmStructureListenerType.FSM_STRUCTURE_LISTENER_NUM];
+
+ public FsmActionListeners() {
+ for(int ic=0;ic<PreFsmActionListenerType.PRE_FSM_ACTION_LISTENER_NUM;++ic){
+ preaction_[ic] = new PreFsmActionListenerHolder();
+ }
+ for(int ic=0;ic<PostFsmActionListenerType.POST_FSM_ACTION_LISTENER_NUM;++ic){
+ postaction_[ic] = new PostFsmActionListenerHolder();
+ }
+ for(int ic=0;ic<FsmProfileListenerType.FSM_PROFILE_LISTENER_NUM;++ic){
+ profile_[ic] = new FsmProfileListenerHolder();
+ }
+ for(int ic=0;ic<FsmStructureListenerType.FSM_STRUCTURE_LISTENER_NUM;++ic){
+ structure_[ic] = new FsmStructureListenerHolder();
+ }
+ }
+
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListener.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListener.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListener.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,65 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.lang.Integer;
+ /**
+ * {@.ja FsmProfileListener クラス}
+ * {@.en FsmProfileListener class}
+ * <p>
+ * {@.ja OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
+ * て、
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ * <ul>
+ * <li> PRE_ON_INIT:
+ * <li> PRE_ON_ENTRY:
+ * <li> PRE_ON_DO:
+ * <li> PRE_ON_EXIT:
+ * <li> PRE_ON_STATUS_CHANGED:
+ * </ul>}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * </ul>}
+ * </p>
+ *
+ */
+public abstract class FsmProfileListener implements Observer{
+ public void update(Observable o, Object obj) {
+ RTC.FsmProfile arg = (RTC.FsmProfile)obj;
+ operator(arg);
+ }
+/*
+ public void update(Observable o, Object obj) {
+ Integer arg = (Integer)obj;
+ operator(arg.intValue());
+ }
+*/
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja FsmProfileListener のコールバック関数}
+ * {@.en This is a the Callback function for FsmProfileListener.}
+ *
+ */
+ public abstract void operator(final RTC.FsmProfile fsmprof);
+ //public abstract void operator(final String config_set_name,final String config_param_name);
+ //public abstract void operator(final int exec_handle);
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerArgument.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerArgument.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerArgument.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,26 @@
+package jp.go.aist.rtm.RTC;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja FsmProfileListenerArgument クラス}
+ * {@.en FsmProfileListenerArgument class}
+ *
+ *
+ */
+public class FsmProfileListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public FsmProfileListenerArgument(int handle,
+ RTC.ReturnCode_t ret){
+ m_exec_handle = handle;
+ m_ret = ret;
+ }
+ public int m_exec_handle;
+ public RTC.ReturnCode_t m_ret;
+}
+
+
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerHolder.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerHolder.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerHolder.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,25 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja FsmProfileListener ホルダクラス}
+ * {@.en FsmProfileListener holder class}
+ * <p>
+ * {@.ja 複数の FsmProfileListener を保持し管理するクラス。}
+ * {@.en This class manages one ore more instances of
+ * FsmProfileListener class.}
+ *
+ */
+
+public class FsmProfileListenerHolder extends Observable{
+ public void notify(final int ec_id, RTC.ReturnCode_t ret) {
+ super.setChanged();
+ FsmProfileListenerArgument arg
+ = new FsmProfileListenerArgument(ec_id,ret);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerType.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerType.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmProfileListenerType.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,74 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja FsmProfileListener のタイプ}
+ * {@.en The types of FsmProfileListener}
+ * <p>
+ * {@.ja <ul>
+ * <li> SET_FSM_PROFILE : FSM Profile設定時
+ * <li> GET_FSM_PROFILE : FSM Profile取得時
+ * <li> ADD_FSM_STATE : FSMにStateが追加された
+ * <li> REMOVE_FSM_STATE : FSMからStateが削除された
+ * <li> ADD_FSM_TRANSITION : FSMに遷移が追加された
+ * <li> REMOVE_FSM_TRANSITION : FSMから遷移が削除された
+ * <li> BIND_FSM_EVENT : FSMにイベントがバインドされた
+ * <li> UNBIND_FSM_EVENT : FSMにイベントがアンバインドされた
+ * </ul>}
+ * {@.en <ul>
+ * <li> SET_FSM_PROFILE : Setting FSM Profile
+ * <li> GET_FSM_PROFILE : Getting FSM Profile
+ * <li> ADD_FSM_STATE : A State added to the FSM
+ * <li> REMOVE_FSM_STATE : A State removed from FSM
+ * <li> ADD_FSM_TRANSITION : A transition added to the FSM
+ * <li> REMOVE_FSM_TRANSITION : A transition removed from FSM
+ * <li> BIND_FSM_EVENT : An event bounded to the FSM
+ * <li> UNBIND_FSM_EVENT : An event unbounded to the FSM
+ * </ul>}
+ * </p>
+ */
+public class FsmProfileListenerType {
+ public static final int SET_FSM_PROFILE = 0;
+ public static final int GET_FSM_PROFILE = 1;
+ public static final int ADD_FSM_STATE = 2;
+ public static final int REMOVE_FSM_STATE = 3;
+ public static final int ADD_FSM_TRANSITION = 4;
+ public static final int REMOVE_FSM_TRANSITION = 5;
+ public static final int BIND_FSM_EVENT = 6;
+ public static final int UNBIND_FSM_EVENT = 7;
+ public static final int FSM_PROFILE_LISTENER_NUM = 8;
+
+ private static final String[] TypeString = {
+ "SET_FSM_PROFILE",
+ "GET_FSM_PROFILE",
+ "ADD_FSM_STATE",
+ "REMOVE_FSM_STATE",
+ "ADD_FSM_TRANSITION",
+ "REMOVE_FSM_TRANSITION",
+ "BIND_FSM_EVENT",
+ "UNBIND_FSM_EVENT",
+ "FSM_PROFILE_LISTENER_NUM",
+ };
+
+ /**
+ * {@.ja FsmProfileListenerType を文字列に変換}
+ * {@.en Convert FsmProfileListenerType into the string.}
+ * <p>
+ * {@.ja FsmProfileListenerType を文字列に変換する}
+ * {@.en Convert FsmProfileListenerType into the string.}
+ * </p>
+ *
+ * @param type
+ * {@.ja 変換対象 FsmProfileListenerType}
+ * {@.en The target FsmProfileListenerType for transformation}
+ *
+ * @return
+ * {@.ja 文字列変換結果}
+ * {@.en Trnasformation result of string representation}
+ *
+ */
+ public static String toString(final int type){
+ if (type < FSM_PROFILE_LISTENER_NUM) {
+ return TypeString[type];
+ }
+ return "";
+ }
+}
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListener.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListener.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListener.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,57 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.lang.Integer;
+ /**
+ * {@.ja FsmStructureListener クラス}
+ * {@.en FsmStructureListener class}
+ * <p>
+ * {@.ja OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
+ * て、
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ * <ul>
+ * <li> PRE_ON_INIT:
+ * <li> PRE_ON_ENTRY:
+ * <li> PRE_ON_DO:
+ * <li> PRE_ON_EXIT:
+ * <li> PRE_ON_STATUS_CHANGED:
+ * </ul>}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * </ul>}
+ * </p>
+ *
+ */
+public abstract class FsmStructureListener implements Observer{
+ public void update(Observable o, Object obj) {
+ Integer arg = (Integer)obj;
+ operator(arg.intValue());
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja FsmStructureListener のコールバック関数}
+ * {@.en This is a the Callback function for FsmStructureListener.}
+ *
+ */
+ public abstract void operator(final int exec_handle);
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerArgument.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerArgument.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerArgument.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,26 @@
+package jp.go.aist.rtm.RTC;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja FsmStructureListenerArgument クラス}
+ * {@.en FsmStructureListenerArgument class}
+ *
+ *
+ */
+public class FsmStructureListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public FsmStructureListenerArgument(int handle,
+ RTC.ReturnCode_t ret){
+ m_exec_handle = handle;
+ m_ret = ret;
+ }
+ public int m_exec_handle;
+ public RTC.ReturnCode_t m_ret;
+}
+
+
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerHolder.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerHolder.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerHolder.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,25 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja FsmStructureListener ホルダクラス}
+ * {@.en FsmStructureListener holder class}
+ * <p>
+ * {@.ja 複数の FsmStructureListener を保持し管理するクラス。}
+ * {@.en This class manages one ore more instances of
+ * FsmStructureListener class.}
+ *
+ */
+
+public class FsmStructureListenerHolder extends Observable{
+ public void notify(final int ec_id, RTC.ReturnCode_t ret) {
+ super.setChanged();
+ FsmStructureListenerArgument arg
+ = new FsmStructureListenerArgument(ec_id,ret);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerType.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerType.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FsmStructureListenerType.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,51 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja FsmStructureListener のタイプ}
+ * {@.en The types of FsmStructureListener}
+ * <p>
+ * {@.ja <ul>
+ * <li> SET_FSM_STRUCTURE: FSM構造の設定
+ * <li> GET_FSM_STRUCTURE: FSM構造の取得
+ * </ul>}
+ * {@.en <ul>
+ * <li> SET_FSM_STRUCTURE: Setting FSM structure
+ * <li> GET_FSM_STRUCTURE: Getting FSM structure
+ * </ul>}
+ * </p>
+ */
+public class FsmStructureListenerType {
+
+ public static final int SET_FSM_STRUCTURE = 0;
+ public static final int GET_FSM_STRUCTURE = 1;
+ public static final int FSM_STRUCTURE_LISTENER_NUM = 2;
+
+ private static final String[] TypeString = {
+ "SET_FSM_STRUCTURE",
+ "GET_FSM_STRUCTURE",
+ "FSM_STRUCTURE_LISTENER_NUM",
+ };
+
+ /**
+ * {@.ja FsmStructureListenerType を文字列に変換}
+ * {@.en Convert FsmStructureListenerType into the string.}
+ * <p>
+ * {@.ja FsmStructureListenerType を文字列に変換する}
+ * {@.en Convert FsmStructureListenerType into the string.}
+ * </p>
+ *
+ * @param type
+ * {@.ja 変換対象 FsmStructureListenerType}
+ * {@.en The target FsmStructureListenerType for transformation}
+ *
+ * @return
+ * {@.ja 文字列変換結果}
+ * {@.en Trnasformation result of string representation}
+ *
+ */
+ public static String toString(final int type){
+ if (type < FSM_STRUCTURE_LISTENER_NUM) {
+ return TypeString[type];
+ }
+ return "";
+ }
+}
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListener.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListener.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListener.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,57 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.lang.Integer;
+ /**
+ * {@.ja PostFsmActionListener クラス}
+ * {@.en PostFsmActionListener class}
+ * <p>
+ * {@.ja OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
+ * て、
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ * <ul>
+ * <li> POST_ON_INIT:
+ * <li> POST_ON_ENTRY:
+ * <li> POST_ON_DO:
+ * <li> POST_ON_EXIT:
+ * <li> POST_ON_STATUS_CHANGED:
+ * </ul>}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * </ul>}
+ * </p>
+ *
+ */
+public abstract class PostFsmActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ Integer arg = (Integer)obj;
+ operator(arg.intValue());
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja PostFsmActionListener のコールバック関数}
+ * {@.en This is a the Callback function for PostFsmActionListener.}
+ *
+ */
+ public abstract void operator(final int exec_handle);
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerArgument.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerArgument.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerArgument.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,26 @@
+package jp.go.aist.rtm.RTC;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja PostFsmActionListenerArgument クラス}
+ * {@.en PostComponentActionListenerArgumen class}
+ *
+ *
+ */
+public class PostFsmActionListenerArgument {
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public PostFsmActionListenerArgument(int handle,
+ RTC.ReturnCode_t ret){
+ m_exec_handle = handle;
+ m_ret = ret;
+ }
+ public int m_exec_handle;
+ public RTC.ReturnCode_t m_ret;
+}
+
+
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerHolder.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerHolder.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerHolder.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,25 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja PostFsmActionListener ホルダクラス}
+ * {@.en PostFsmActionListener holder class}
+ * <p>
+ * {@.ja 複数の PostFsmActionListener を保持し管理するクラス。}
+ * {@.en This class manages one ore more instances of
+ * PostFsmActionListener class.}
+ *
+ */
+
+public class PostFsmActionListenerHolder extends Observable{
+ public void notify(final int ec_id, RTC.ReturnCode_t ret) {
+ super.setChanged();
+ PostFsmActionListenerArgument arg
+ = new PostFsmActionListenerArgument(ec_id,ret);
+ super.notifyObservers((Object)arg);
+ super.clearChanged();
+ }
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerType.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerType.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PostFsmActionListenerType.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,62 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja PostFsmActionListener のタイプ}
+ * {@.en The types of PostFsmActionListener}
+ * <p>
+ * {@.ja <ul>
+ * <li> POST_ON_INIT: on_init 直前
+ * <li> POST_ON_ENTRY: on_entry 直前
+ * <li> POST_ON_DO: on_do 直前
+ * <li> POST_ON_EXIT: on_exit 直前
+ * <li> POST_ON_STATE_CAHNGE: 状態遷移直前
+ * </ul>}
+ * {@.en <ul>
+ * <li> POST_ON_INIT: on_init 直前
+ * <li> POST_ON_ENTRY: on_entry 直前
+ * <li> POST_ON_DO: on_do 直前
+ * <li> POST_ON_EXIT: on_exit 直前
+ * <li> POST_ON_STATE_CAHNGE:
+ * </ul>}
+ * </p>
+ */
+public class PostFsmActionListenerType {
+ public static final int POST_ON_INIT = 0;
+ public static final int POST_ON_ENTRY = 1;
+ public static final int POST_ON_DO = 2;
+ public static final int POST_ON_EXIT = 3;
+ public static final int POST_ON_STATE_CHANGE = 4;
+ public static final int POST_FSM_ACTION_LISTENER_NUM = 5;
+
+ private static final String[] TypeString = {
+ "POST_ON_INIT",
+ "POST_ON_ENTRY",
+ "POST_ON_DO",
+ "POST_ON_EXIT",
+ "POST_ON_STATE_CAHNGE",
+ "PSOT_FSM_ACTION_LISTENER_NUM",
+ };
+
+ /**
+ * {@.ja PostFsmActionListenerType を文字列に変換}
+ * {@.en Convert PostFsmActionListenerType into the string.}
+ * <p>
+ * {@.ja PostFsmActionListenerType を文字列に変換する}
+ * {@.en Convert PostFsmActionListenerType into the string.}
+ * </p>
+ *
+ * @param type
+ * {@.ja 変換対象 PostFsmActionListenerType}
+ * {@.en The target PostFsmActionListenerType for transformation}
+ *
+ * @return
+ * {@.ja 文字列変換結果}
+ * {@.en Trnasformation result of string representation}
+ *
+ */
+ public static String toString(final int type){
+ if (type < POST_FSM_ACTION_LISTENER_NUM) {
+ return TypeString[type];
+ }
+ return "";
+ }
+}
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListener.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListener.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListener.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,57 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import java.lang.Integer;
+ /**
+ * {@.ja PreFsmActionListener クラス}
+ * {@.en PreFsmActionListener class}
+ * <p>
+ * {@.ja OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
+ * て、
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+ * でコールされるリスなクラスの基底クラス。
+ * <ul>
+ * <li> PRE_ON_INIT:
+ * <li> PRE_ON_ENTRY:
+ * <li> PRE_ON_DO:
+ * <li> PRE_ON_EXIT:
+ * <li> PRE_ON_STATUS_CHANGED:
+ * </ul>}
+ * {@.en This class is abstract base class for listener classes that
+ * provides callbacks for various events in rtobject.
+ * <ul>
+ * <li> on_init()
+ * <li> on_entry()
+ * <li> on_do()
+ * <li> on_exit()
+ * <li> on_state_update()
+ * </ul>
+ * </ul>}
+ * </p>
+ *
+ */
+public abstract class PreFsmActionListener implements Observer{
+ public void update(Observable o, Object obj) {
+ String arg = (String)obj;
+ operator(arg);
+ }
+ /**
+ * {@.ja 仮想コールバック関数}
+ * {@.en Virtual Callback function}
+ * <p>
+ * {@.ja PreFsmActionListener のコールバック関数}
+ * {@.en This is a the Callback function for PreFsmActionListener.}
+ *
+ */
+ public abstract void operator(final String exec_handle);
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerHolder.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerHolder.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerHolder.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,23 @@
+package jp.go.aist.rtm.RTC;
+
+import java.util.Observable;
+
+import java.lang.Integer;
+ /**
+ * {@.ja PreFsmActionListener ホルダクラス}
+ * {@.en PreFsmActionListener holder class}
+ * <p>
+ * {@.ja 複数の PreFsmActionListener を保持し管理するクラス。}
+ * {@.en This class manages one ore more instances of
+ * PreFsmActionListener class.}
+ *
+ */
+public class PreFsmActionListenerHolder extends Observable{
+ public void notify(final int exec_handle) {
+ super.setChanged();
+ Integer arg = new Integer(exec_handle);
+ super.notifyObservers(arg);
+ super.clearChanged();
+ }
+}
+
Added: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerType.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerType.java (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PreFsmActionListenerType.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -0,0 +1,62 @@
+package jp.go.aist.rtm.RTC;
+ /**
+ * {@.ja PreFsmActionListener のタイプ}
+ * {@.en The types of PreFsmActionListener}
+ * <p>
+ * {@.ja <ul>
+ * <li> PRE_ON_INIT: on_init 直前
+ * <li> PRE_ON_ENTRY: on_entry 直前
+ * <li> PRE_ON_DO: on_do 直前
+ * <li> PRE_ON_EXIT: on_exit 直前
+ * <li> PRE_ON_STATE_CAHNGE: 状態遷移直前
+ * </ul>}
+ * {@.en <ul>
+ * <li> PRE_ON_INIT: on_init 直前
+ * <li> PRE_ON_ENTRY: on_entry 直前
+ * <li> PRE_ON_DO: on_do 直前
+ * <li> PRE_ON_EXIT: on_exit 直前
+ * <li> PRE_ON_STATE_CAHNGE:
+ * </ul>}
+ * </p>
+ */
+public class PreFsmActionListenerType {
+ public static final int PRE_ON_INIT = 0;
+ public static final int PRE_ON_ENTRY = 1;
+ public static final int PRE_ON_DO = 2;
+ public static final int PRE_ON_EXIT = 3;
+ public static final int PRE_ON_STATE_CHANGE = 4;
+ public static final int PRE_FSM_ACTION_LISTENER_NUM = 5;
+
+ private static final String[] TypeString = {
+ "PRE_ON_INIT",
+ "PRE_ON_ENTRY",
+ "PRE_ON_DO",
+ "PRE_ON_EXIT",
+ "PRE_ON_STATE_CAHNGE",
+ "PRE_FSM_ACTION_LISTENER_NUM",
+ };
+
+ /**
+ * {@.ja PreFsmActionListenerType を文字列に変換}
+ * {@.en Convert PreFsmActionListenerType into the string.}
+ * <p>
+ * {@.ja PreFsmActionListenerType を文字列に変換する}
+ * {@.en Convert PreFsmActionListenerType into the string.}
+ * </p>
+ *
+ * @param type
+ * {@.ja 変換対象 PreFsmActionListenerType}
+ * {@.en The target PreFsmActionListenerType for transformation}
+ *
+ * @return
+ * {@.ja 文字列変換結果}
+ * {@.en Trnasformation result of string representation}
+ *
+ */
+ public static String toString(final int type){
+ if (type < PRE_FSM_ACTION_LISTENER_NUM) {
+ return TypeString[type];
+ }
+ return "";
+ }
+}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2016-12-14 23:15:38 UTC (rev 883)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2016-12-14 23:16:12 UTC (rev 884)
@@ -5984,7 +5984,187 @@
{
m_configsets.removeConfigurationSetNameListener(type,listener);
}
+
+ //============================================================
+ // FSM Listener
/**
+ * {@.ja PreFsmActionListener リスナを追加する}
+ * {@.en Adding PreFsmAction type listener}
+ *
+ */
+ public void
+ addPreFsmActionListener(int listener_type,
+ PreFsmActionListener listener,
+ boolean autoclean) {
+ m_fsmActionListeners.
+ preaction_[listener_type].addObserver(listener);
+ }
+ public <DataType>
+ PreFsmActionListener
+ addPreFsmActionListener(int listener_type,
+ DataType obj,
+ String memfunc) {
+ class Noname extends PreFsmActionListener {
+ public Noname(DataType obj, String memfunc) {
+ m_obj = obj;
+ try {
+ Class clazz = m_obj.getClass();
+
+ m_method = clazz.getMethod(memfunc,String.class,String.class);
+
+ }
+ catch(java.lang.Exception e){
+ rtcout.println(Logbuf.WARN,
+ "Exception caught."+e.toString());
+ }
+ }
+ public void operator(final String state) {
+ try {
+ m_method.invoke(
+ state);
+ }
+ 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);
+ addPreFsmActionListener(listener_type, listener, true);
+ return listener;
+ }
+
+
+ /**
+ * {@.ja PreFsmActionListener リスナを削除する}
+ * {@.en Removing PreFsmAction type listener}
+ *
+ */
+ public void
+ removePreFsmActionListener(int listener_type,
+ PreFsmActionListener listener) {
+ m_fsmActionListeners.
+ preaction_[listener_type].deleteObserver(listener);
+ }
+
+
+ /**
+ * {@.ja PostFsmActionListener リスナを追加する}
+ * {@.en Adding PostFsmAction type listener}
+ *
+ */
+ public void
+ addPostFsmActionListener(int listener_type,
+ PostFsmActionListener listener,
+ boolean autoclean) {
+ m_fsmActionListeners.
+ postaction_[listener_type].addObserver(listener);
+ }
+
+
+ /**
+ * {@.ja PostFsmActionListener リスナを削除する}
+ * {@.en Removing PostFsmAction type listener}
+ *
+ */
+ public void
+ removePostFsmActionListener(int listener_type,
+ PostFsmActionListener listener) {
+ m_fsmActionListeners.
+ postaction_[listener_type].deleteObserver(listener);
+ }
+
+ /**
+ * {@.ja FsmProfileListener リスナを追加する}
+ * {@.en Adding FsmProfile type listener}
+ */
+ public void
+ addFsmProfileListener(int listener_type,
+ FsmProfileListener listener,
+ boolean autoclean) {
+ m_fsmActionListeners.
+ profile_[listener_type].addObserver(listener);
+ }
+ public <DataType>
+ FsmProfileListener
+ addFsmProfileListener(int listener_type,
+ DataType obj,
+ String memfunc) {
+ class Noname extends FsmProfileListener {
+ public Noname(DataType obj, String memfunc) {
+ m_obj = obj;
+ try {
+ Class clazz = m_obj.getClass();
+
+ m_method = clazz.getMethod(memfunc,String.class,String.class);
+
+ }
+ catch(java.lang.Exception e){
+ rtcout.println(Logbuf.WARN,
+ "Exception caught."+e.toString());
+ }
+ }
+ public void operator(final RTC.FsmProfile profile) {
+ try {
+ m_method.invoke(
+ m_obj,
+ 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);
+ addFsmProfileListener(listener_type, listener, true);
+ return listener;
+ }
+
+
+ /**
+ * {@.ja FsmProfileListener リスナを削除する}
+ * {@.en Removing FsmProfile type listener}
+ *
+ */
+ public void
+ removeFsmProfileListener(int listener_type,
+ FsmProfileListener listener) {
+ m_fsmActionListeners.
+ profile_[listener_type].deleteObserver(listener);
+ }
+
+ /**
+ * {@.ja FsmStructureListener リスナを追加する}
+ * {@.en Adding FsmStructure type listener}
+ *
+ */
+ public void
+ addFsmStructureListener(int listener_type,
+ FsmStructureListener listener,
+ boolean autoclean) {
+ m_fsmActionListeners.
+ structure_[listener_type].addObserver(listener);
+ }
+
+
+ /**
+ * {@.ja FsmStructureListener リスナを削除する}
+ * {@.en Removing FsmStructure type listener}
+ *
+ */
+ public void
+ removeFsmStructureListener(int listener_type,
+ FsmStructureListener listener) {
+ m_fsmActionListeners.
+ structure_[listener_type].deleteObserver(listener);
+ }
+
+ /**
* {@.ja RTC を終了する。}
* {@.en Shutdown RTC}
*
@@ -6768,4 +6948,24 @@
*
*/
protected ComponentActionListeners m_actionListeners = new ComponentActionListeners();
+ /**
+ * {@.ja PortConnectListenerホルダ}
+ * {@.en PortConnectListener holder}
+ * <p>
+ * {@.ja PortConnectListenrを保持するホルダ}
+ * {@.en Holders of PortConnectListeners}
+ */
+ //protected PortConnectListeners m_portconnListeners = new PortConnectListeners();
+
+
+ /**
+ * {@.ja ComponentActionListenerホルダ}
+ * {@.en ComponentActionListener holder}
+ * <p>
+ * {@.ja ComponentActionListenrを保持するホルダ}
+ * {@.en Holders of ComponentActionListeners}
+ *
+ */
+ protected FsmActionListeners m_fsmActionListeners = new FsmActionListeners();
+
}
More information about the openrtm-commit
mailing list