Project

General

Profile

Actions

機能 #2014

closed

ComponentAction listener の追加

Added by n-ando almost 14 years ago. Updated almost 13 years ago.

Status:
終了
Priority:
高め
Assignee:
-
Target version:
-
Start date:
01/27/2011
Due date:
% Done:

100%

Estimated time:

Description

  • RTコンポーネントの各種アクション(ComponentAction)をフックするためのリスナクラス、ComponentAction listener を追加する。
    • PreAction: 引数に ec_id を取るリスナ
    • PostAction: 引数に ec_id と ReturnCode_t をとるリスナ
  • RTObject にリスナホルダを持たせる
  • RTObject のon_xxx() 関数内の onXxx() の前後にPreActionとPostActionを仕掛ける
  • RTObject にリスナをセットする関数を追加する
Actions #2

Updated by Anonymous almost 14 years ago

ComponentActionListenerに実装は終了.

Actions #3

Updated by Anonymous almost 14 years ago

  • % Done changed from 0 to 30

Templateを除く部分に関しては動作確認済み。

Actions #4

Updated by Anonymous over 13 years ago

Generics を使用して実装予定。
リスナの登録では、method名を文字列で指定する。

    public <DataType>
    PreComponentActionListener
    addPreComponentActionListener(int listener_type,
                                   DataType obj,
                                   String memfunc) {
      class Noname extends PreComponentActionListener {
          public Noname(DataType obj, String memfunc) {
              m_obj = obj;
              try {
                  Class clazz = m_obj.getClass();
                  m_method = clazz.getMethod(memfunc,int.class);
              }
              catch(java.lang.Exception e){
                  rtcout.println(Logbuf.WARN,
                      "Exception caught."+e.toString());
              }
          }
          public void operator(final int exec_handle) {
              try {
                  m_method.invoke(
                        m_obj,
                        exec_handle);
              }
              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);
      addPreComponentActionListener(listener_type, listener, true);
      return listener;
    }
Actions #5

Updated by Anonymous over 13 years ago

コールバック

リスナーを準備する。

    public class TestPreComponentActionListener {
        public void listener_ON_INITIALIZE(int ic){
            System.out.println("------------------------------");
            System.out.println("PreComponentActionListener PRE_ON_INITIALIZE");
            System.out.println("------------------------------");
        }
    }

リスナーを登録する。

        TestPreComponentActionListener pcal 
            = new TestPreComponentActionListener();
        addPreComponentActionListener(0,pcal,"listener_ON_INITIALIZE");

Actions #6

Updated by Anonymous over 13 years ago

  • Status changed from 担当 to 解決
  • % Done changed from 30 to 100
Actions #7

Updated by n-ando almost 13 years ago

  • Status changed from 解決 to 終了
Actions

Also available in: Atom PDF