[openrtm-commit:01629] r732 - in branches/RELENG_1_1: . jp.go.aist.rtm.RTC jp.go.aist.rtm.RTC/idl jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 10月 28日 (水) 10:44:04 JST
Author: kawauchi
Date: 2015-10-28 10:44:04 +0900 (Wed, 28 Oct 2015)
New Revision: 732
Added:
branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java
Removed:
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java
Modified:
branches/RELENG_1_1/
branches/RELENG_1_1/jp.go.aist.rtm.RTC/
branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
Log:
[compat,merge] r661,663,670,672,673 merged from trunk.
Property changes on: branches/RELENG_1_1
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658
+ /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/DesignChangeOfEC:648-660
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658,661,663,670,672-673
Property changes on: branches/RELENG_1_1/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/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/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/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658
+ /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/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/DesignChangeOfEC/jp.go.aist.rtm.RTC:648-660
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/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/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658,661,663,670,672-673
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-28 01:44:04 UTC (rev 732)
@@ -115,6 +115,8 @@
<property name="idl.ComponentObserver" value="${idl.path}/ComponentObserver.idl" />
+ <property name="idl.Logger" value="${idl.path}/Logger.idl" />
+
<property name="idl.test.CorbaConsumer" value="${idl.path.tests}/CorbaConsumer/Hello.idl" />
<property name="idl.test.CorbaPort" value="${idl.path.tests}/CorbaPort/MyService.idl" />
@@ -472,6 +474,12 @@
</exec>
+ <exec executable="${java.home}\..\bin\idlj">
+
+ <arg line="-v -fall -td ${source} -i ${idl.path} -emitAll ${idl.Logger}"/>
+
+ </exec>
+
</target>
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl (from rev 670, trunk/jp.go.aist.rtm.RTC/idl/Logger.idl)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/idl/Logger.idl 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,388 @@
+// -*- IDL -*-
+/*!
+ * @file Logger.idl
+ * @brief Component logger SDO service
+ * @date $Date$
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2011
+ * Noriaki Ando
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id$
+ *
+ */
+
+#include <BasicDataType.idl>
+#include <SDOPackage.idl>
+/*!
+ * @if jp
+ * @brief コンポーネントログ収集サービスインターフェース
+ *
+ * コンポーネントのログ情報を外部から取得するためのインターフェース。コ
+ * ンポーネントに対して、本SDOサービスオブジェクトをアタッチすることで、
+ * コンポーネントが出力するログを外部から取得することができる。
+ *
+ * @since 1.1
+ *
+ * @else
+ * @brief Component logging service interface
+ *
+ * This interface defines logging service of an RT-Component from
+ * outside. Attaching this service interface to an RT-Component, you
+ * can get logging information from the RT-Component.
+ *
+ * @since 1.1
+ * @endif
+ *
+ */
+module OpenRTM
+{
+ /*!
+ * @if jp
+ *
+ * @brief ログレベル
+ *
+ * ログレベル。ログレベルは9段階あり、それぞれ以下の意味を持つ。
+ *
+ * - SILENT : ロギング機能をオフにするための疑似レベル
+ * - ERROR : エラーが発生したことを意味するログレベル
+ * - WARN : エラーではないが注意すべき警告を意味するログレベル
+ * - INFO : 付加的な情報を提供するためのログレベル
+ * - NORMAL : 通常の情報を提供するためのログレベル
+ * - DEBUG : デバッグ情報を提供する際のログレベル
+ * - TRACE : トレースレベルの情報を提供する際のログレベル
+ * - VERBOSE : トレース情報以上に詳細な情報を提供する際のログレベル
+ * - PARANOID: リアルタイム周期処理実行時等の情報を提供するログレベル
+ *
+ * @else
+ *
+ * @brief Log level
+ *
+ * This enumeration defines log levels. The log level consists of
+ * nine levels, and each level means the following meaning.
+ *
+ * - SILENT : Pseudo log level to stop logging function.
+ * - ERROR : This log level means that an error event is occurring.
+ * - WARN : This log level means that a warning event is occurring.
+ * - INFO : This log level used to notify information.
+ * - NORMAL : This log level means that an event is normal thing.
+ * - DEBUG : This log level used to notify debugging information.
+ * - TRACE : This log level used to notify trace information.
+ * - VERBOSE : This log level used to notify more detailed information.
+ * - PARANOID: This is used only to notify information in real-time loop.
+ *
+ * @endif
+ */
+ enum LogLevel
+ {
+ SILENT,
+ ERROR,
+ WARN,
+ INFO,
+ NORMAL,
+ DEBUG,
+ TRACE,
+ VERBOSE,
+ PARANOID
+ };
+
+ /*!
+ * @if jp
+ * @brief ログレコード構造体
+ *
+ * ログメッセージを含むログ情報を保持する構造体
+ *
+ * @else
+ * @brief Log record structure
+ *
+ * This struct defines logging information including log message.
+ *
+ * @endif
+ *
+ */
+ struct LogRecord
+ {
+ /*!
+ * @if jp
+ * @brief 時刻
+ * タイムスタンプ
+ * @else
+ * @brief Time
+ * Time stump.
+ * @endif
+ */
+ RTC::Time time;
+
+ /*!
+ * @if jp
+ * @brief ロガー名
+ * ログを書きこんだロガーオブジェクト名
+ * @else
+ * @brief logger name
+ * The logger name which writes this record.
+ * @endif
+ */
+ string loggername;
+
+ /*!
+ * @if jp
+ * @brief ログレベル
+ * このレコードのログレベル
+ * @else
+ * @brief Log level
+ * The log level of this record
+ * @endif
+ */
+ LogLevel level;
+
+ /*!
+ * @if jp
+ * @brief メッセージ
+ * ログメッセージ
+ * @else
+ * @brief Message
+ * Log message.
+ * @endif
+ */
+ string message;
+ };
+
+
+ /*!
+ * @if jp
+ *
+ * @interface Logger インターフェース
+ *
+ * 個別のRTCのログ情報を取得するためのサービスインターフェース。SDO
+ * Service として対象となるRTC/SDOに対してアタッチされ、RTC/SDOのログ
+ * 情報を外部から取得する。実際の処理シーケンスは以下の通りである。
+ *
+ * -# SDO::get_configuration() により Configuration オブジェクトを取得
+ * -# Configuration::add_service_profile() によりTool側の
+ * Logger を ServiceProfile により RTC に与える。
+ * ServiceProfile のメンバーは以下のように設定すること
+ * - id: UUID など一意なIDを設定する。削除時にも必要になるので、Tool
+ * 側ではIDを保持しておかなければならない。
+ * - interface_type: 当該サービスのIFRのIDを文字列として指定。RTC側で
+ * はこの文字列により当該サービスオブジェクトを受け入れるか決定す
+ * るため指定は必須となる。
+ * - properties: RTC側のサービスの受け入れ側に通知するプロパティを設
+ * 定する。このサービスでは、下記のログレベル関連のプロパティを
+ * 指定する。
+ * - service: SDOService オブジェクトの参照を指定する。
+ * -# RTC側でロガーへの書き込みが有った場合には publish() オペレーション
+ * が LogRecord 構造体としてログメッセージやタイムスタンプをサー
+ * ビス側に通知する。サービスを保持する側では、LogRecord内の情報
+ * をファイルに書き込む、表示する等の方法で利用することができる。
+ * -# RTC側が終了するときには、close() オペレーションが呼び出されるの
+ * で、サービス提供側は適切な終了処理を行う必要がある。close()が呼
+ * ばれた場合は、remove_service_profile() により明示的にサービスを
+ * 削除する必要はない。またRTC側ではclose() を呼んだ後は、当該サー
+ * ビスに関する情報やリソースを適切に開放しなければならない。
+ * -# ツール等のサービス提供側が終了する場合などは、
+ * remove_service_profile() オペレーションを呼び出し、当該RTC上の
+ * リソースを適切に開放する必要がある。RTC側は、
+ * remove_service_profile() が呼び出された際には、当該ロギングに関
+ * するリソースを適切に開放する必要がある。
+ *
+ * 上記のプロセスを下記シーケンス図に示す。
+ *
+ * <pre>
+ *
+ * [RTC] [Configuration] [Logger] [Tool]
+ * | | | |
+ * | | get_configuration() | |
+ * |<------------------------------------------------|
+ * | | | |
+ * | | add_service_profile(prof) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | publish(logrecord) | |
+ * |----------------------------------->| |
+ * | | publish(logrecord) | |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | : | |
+ * | | 1) RTCが先に終了するとき |
+ * | | : | |
+ * | | [close()] | |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | 2) ツールがロギングを終了するとき |
+ * | | : | |
+ * | | remove_service_profile(id) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | x x
+ *
+ * </pre>
+ *
+ * なお、ServiceProfile::properties に指定するプロパティとしては、
+ *
+ * - logger.log_level: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE,
+ * PARANOID)
+ * - logger.filter: logger name or "ALL"
+ *
+ * がある、
+ *
+ * - logger.log_level: ERROR, WARN, INFO, NORMAL, DEBUG, TRACE,
+ * VERBOSE またはPARANOID のうち一つを指定する。無指定の場合は
+ * NORMAL と同等となる。指定されたレベルと同等あるいはそれより重要
+ * な情報がロギングされる。すなわち、それぞれのログレベルを指定した
+ * 際に出力されるログは以下の関係になる。
+ * - ERROR : (ERROR)
+ * - WARN : (ERROR, WARN)
+ * - INFO : (ERROR, WARN, INFO)
+ * - NORMAL : (ERROR, WARN, INFO, NORMAL)
+ * - DEBUG : (ERROR, WARN, INFO, NORMAL, DEBUG)
+ * - TRACE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE)
+ * - VERBOSE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE)
+ * - PARANOID: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARA)
+ * - logger.filter: RTC内部は、RTC本体、データポート、サービスポート
+ * 等それぞれのオブジェクトにロガーオブジェクトが存在する。このプロ
+ * パティはロギングする対象のロガーオブジェクトをカンマ区切りで指定
+ * する。または、ALLを指定することでRTC配下のすべてのロギングオブジェ
+ * クトからのメッセージを受信する。無指定の場合はALLと同等になる。
+ *
+ * @else
+ * @class
+ *
+ * @interface Logger interface
+ *
+ * This interface defines logging service for each RT-Component.
+ * This service would be attached to a target RTC/SDO, and provides
+ * functionality to collect log information from remote
+ * applications. Actual process sequences are the following.
+ *
+ * -# Get configuration object by SDO::get_configuration()
+ * -# Attach Logger object with ServiceProfile by
+ * Configuration::add_service_profile(). ServiceProfile should be
+ * set as follows.
+ * - id: An unique ID like UUID. This ID is used when this service
+ * is removed. Tools or applications should keep the ID for
+ * this.
+ * - interface_type: Specify this service's IFR ID in string. This
+ * string is used to search available service in the RTC,
+ * and if it matches with available SDO services, this
+ * service is accepted.
+ * - properties: This member specifies properties to notify
+ * information to the target RTC. The following properties
+ * for log level and others would be specified in this
+ * properties.
+ *
+ * - service: A SDOService object reference is specified.
+ * -# When logging occurs in the RTC side, the "publish()" operation
+ * notifies a log message, time stump and so on to the service
+ * provider as a LogRecord structure. The service provider can
+ * use notified information for example writing to files and
+ * showing them on the display.
+ * -# When RTC is terminated, the "close()" operation is called, and
+ * the service provider has to terminate the logging service
+ * properly. In this case, tools and applications that have
+ * service provider do not need to call remove_service_profile()
+ * and remove the service explicitly. After calling close()
+ * operation, the RTC has to release the service profile and
+ * resources.
+ * -# When tools and applications terminate services, they have to
+ * call remove_service_profile() operation, and have to release
+ * resources in the target RTC. When remove_service_profile() is
+ * called, the RTC have to release service profile and resources
+ * for this service.
+ *
+ * The following diagram shows above mentioned sequence.
+ *
+ * <pre>
+ *
+ * [RTC] [Configuration] [Logger] [Tool]
+ * | | | |
+ * | | get_configuration() | |
+ * |<------------------------------------------------|
+ * | | | |
+ * | | add_service_profile(prof) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | publish(logrecord) | |
+ * |----------------------------------->| |
+ * | | publish(logrecord) | |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | : | |
+ * | | 1) When RTC is terminated |
+ * | | : | |
+ * | | [close()] | |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | 2) When tool terminates logging |
+ * | | : | |
+ * | | remove_service_profile(id) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | x x
+ *
+ * </pre>
+ *
+ * So far, the following properties for ServiceProfile::properties
+ * are available.
+ *
+ * - logger.log_level: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE,
+ * PARANOID)
+ * - logger.filter: logger name or "ALL"
+ *
+ *
+ * - logger.log_level: One of ERROR, WARN, INFO, NORMAL, DEBUG,
+ * TRACE, VERBOSE or PARANOID can be specified. If no
+ * properties are specified, it will be NORMAL. Log messages
+ * equals and/or more important specified log level would be
+ * published. The following list shows the relation between
+ * specified level and published level.
+ * - ERROR : (ERROR)
+ * - WARN : (ERROR, WARN)
+ * - INFO : (ERROR, WARN, INFO)
+ * - NORMAL : (ERROR, WARN, INFO, NORMAL)
+ * - DEBUG : (ERROR, WARN, INFO, NORMAL, DEBUG)
+ * - TRACE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE)
+ * - VERBOSE : (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE)
+ * - PARANOID: (ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARA)
+ * - logger.filter: Some logger objects exist in some object of an
+ * RTC such as RTC body, data port, service port and so on.
+ * Some logger objects exist in some object of an RTC such as
+ * RTC body, data port, service port and so on. This properties
+ * specify target logger names separated with commas. If ALL is
+ * specified, all the logger's messages under the target RTC's
+ * logger would be published. If no property is specified, all
+ * the messages will be published.
+ *
+ * @endif
+ *
+ */
+ interface Logger
+ : SDOPackage::SDOService
+ {
+ /*!
+ * @if jp
+ * @brief ログメッセージ配信
+ * ログメッセージを配信する
+ * @else
+ * @brief Publish log message
+ * This operation publishes log message.
+ * @endif
+ */
+ oneway void publish(in LogRecord record);
+
+ /*!
+ * @if jp
+ * @brief サービスの終了
+ * ロギングサービスの終了を通知する
+ * @else
+ * @brief Terminate service
+ * This operation notifies logging service.
+ * @endif
+ */
+ void close();
+ };
+};
+
Deleted: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaObjectManager.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -1,81 +0,0 @@
-package jp.go.aist.rtm.RTC;
-
-import jp.go.aist.rtm.RTC.executionContext.ExecutionContextBase;
-
-import org.omg.CORBA.ORB;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.POAPackage.ObjectNotActive;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
-import org.omg.PortableServer.POAPackage.ServantNotActive;
-import org.omg.PortableServer.POAPackage.WrongPolicy;
-
-import RTC.ExecutionContextServiceHelper;
-import RTC.RTObjectHelper;
-
-
-/**
- * <p>CorbaObjectManagerã¯ã©ã¹ã§ãã
- * CORBA ãªãã¸ã§ã¯ããã¢ã¯ãã£ãåãéã¢ã¯ãã£ãåãã¾ãã</p>
- */
-class CorbaObjectManager {
- /**
- * <p>ã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
- *
- * @param orbãORB
- * @param poaãPOA
- */
- public CorbaObjectManager(ORB orb, POA poa) {
- m_pPOA = poa;
- }
-
- /**
- * <p>CORBA ãªãã¸ã§ã¯ã(RTObjct)ãã¢ã¯ãã£ãåãã¾ãã</p>
- *
- * @param comp ã¢ã¯ãã£ãå対象RTObject
- *
- * @exception ServantAlreadyActive 対象Servantããã§ã«activateæ¸ã¿
- * @exception WrongPolicy POA ã§ãµãã¼ãããã¦ããªãããªã·ã¼ã使ç¨
- * @exception ObjectNotActive æå®ããã oid ãæã¤ãªãã¸ã§ã¯ãã Active Object Map ã«ãªãå ´å
- */
- public void activate(RTObject_impl comp)
- throws ServantAlreadyActive, WrongPolicy, ObjectNotActive {
- if( comp.m_objref==null ) {
- byte[] id = m_pPOA.activate_object(comp);
- comp.setObjRef(RTObjectHelper.narrow(m_pPOA.id_to_reference(id)));
- }
- }
-
- /**
- * <p>CORBA ãªãã¸ã§ã¯ã(ExecutionContext)ãã¢ã¯ãã£ãåãã¾ãã</p>
- *
- * @param comp ã¢ã¯ãã£ãå対象ExecutionContext
- *
- * @exception ServantAlreadyActive 対象Servantããã§ã«activateæ¸ã¿
- * @exception WrongPolicy POA ã§ãµãã¼ãããã¦ããªãããªã·ã¼ã使ç¨
- * @exception ObjectNotActive æå®ããã oid ãæã¤ãªãã¸ã§ã¯ãã Active Object Map ã«ãªãå ´å
- */
- public void activate(ExecutionContextBase comp) throws ServantAlreadyActive, WrongPolicy, ObjectNotActive {
- byte[] id = m_pPOA.activate_object(comp);
- comp.setObjRef(ExecutionContextServiceHelper.narrow(m_pPOA.id_to_reference(id)));
- }
- /**
- * <p>CORBA ãªãã¸ã§ã¯ããéã¢ã¯ãã£ãåãã¾ãã</p>
- *
- * @param comp éã¢ã¯ãã£ãå対象ãªãã¸ã§ã¯ã
- *
- * @exception ServantAlreadyActive 対象Servantãactivateåããã¦ããªã
- * @exception WrongPolicy POA ã§ãµãã¼ãããã¦ããªãããªã·ã¼ã使ç¨
- * @exception ObjectNotActive æå®ããã oid ãæã¤ãªãã¸ã§ã¯ãã Active Object Map ã«ãªãå ´å
- *
- */
- public void deactivate(Servant comp) throws ServantNotActive, WrongPolicy, ObjectNotActive {
- byte[] id = m_pPOA.servant_to_id(comp);
- m_pPOA.deactivate_object(id);
- }
-
- /**
- * POA
- */
- private POA m_pPOA;
-}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -50,7 +50,9 @@
"corba.nameservice.replace_endpoint", "NO",
"exec_cxt.periodic.type", "jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
"exec_cxt.periodic.rate", "1000",
- "exec_cxt.evdriven.type", "jp.go.aist.rtm.RTC.executionContext.EventDrivenExecutionContext",
+ "exec_cxt.sync_transition", "YES",
+ "exec_cxt.transition_timeout", "0.5",
+ //"exec_cxt.evdriven.type", "jp.go.aist.rtm.RTC.executionContext.EventDrivenExecutionContext",
"manager.modules.load_path", "./",
"manager.modules.abs_path_allowed", "YES",
"manager.is_master", "NO",
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/FactoryGlobal.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -2,6 +2,7 @@
import java.lang.reflect.Constructor;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
@@ -187,6 +188,7 @@
* {@.en Map of FactoryEntry}
*/
protected HashMap<IDENTIFIER, FactoryEntry> m_creators = new HashMap<IDENTIFIER, FactoryEntry>();
+ private HashMap<ABSTRACTCLASS, FactoryEntry> m_objects = new HashMap<ABSTRACTCLASS, FactoryEntry>();
/**
* {@.ja Identifierããããã«åå¨ããããã§ãã¯ããã}
@@ -233,7 +235,7 @@
if (m_creators.containsKey(id)){
return ReturnCode.ALREADY_EXISTS;
}
- FactoryEntry f = new FactoryEntry(creator, destructor);
+ FactoryEntry f = new FactoryEntry(id, creator, destructor);
m_creators.put(id,f);
return ReturnCode.FACTORY_OK;
}
@@ -278,7 +280,9 @@
if (!m_creators.containsKey(id)){
return null;
}
- return m_creators.get(id).creator_.creator_();
+ ABSTRACTCLASS obj = m_creators.get(id).creator_.creator_();
+ m_objects.put(obj, m_creators.get(id));
+ return obj;
}
/**
* {@.ja ãªãã¸ã§ã¯ãåé¤ã}
@@ -296,11 +300,13 @@
* {@.en Deleteed object.}
*
*/
- public void deleteObject(final IDENTIFIER id, ABSTRACTCLASS obj) {
+ public ReturnCode deleteObject(final IDENTIFIER id, ABSTRACTCLASS obj) {
if (!m_creators.containsKey(id)){
- return ;
+ return deleteObject(obj);
}
m_creators.get(id).destructor_.destructor_(obj);
+ m_objects.remove(obj);
+ return ReturnCode.FACTORY_OK;
}
/**
* {@.ja ãªãã¸ã§ã¯ãåé¤ã}
@@ -314,15 +320,127 @@
* {@.ja åé¤ãããªãã¸ã§ã¯ã}
* {@.en Deleteed object.}
*/
- public void deleteObject(ABSTRACTCLASS obj) {
- Iterator it = m_creators.keySet().iterator();
+ public ReturnCode deleteObject(ABSTRACTCLASS obj) {
+ if(!m_objects.containsKey(obj)) {
+ return ReturnCode.NOT_FOUND;
+ }
+ m_objects.get(obj).destructor_.destructor_(obj);
+ m_objects.remove(obj);
+ return ReturnCode.FACTORY_OK;
+ }
+
+ /**
+ * {@.ja çææ¸ã¿ãªãã¸ã§ã¯ããªã¹ãã®åå¾}
+ * {@.en Getting created objects}
+ * <p>
+ * {@.ja ãã®ãã¡ã¯ããªã§çæããããªãã¸ã§ã¯ãã®ãªã¹ããåå¾ããã}
+ * {@.en This operation returns a list of created objects by the factory.}
+ *
+ * @return
+ * {@.ja çææ¸ã¿ãªãã¸ã§ã¯ããªã¹ã}
+ * {@.en created object list}
+ *
+ */
+ public ArrayList<ABSTRACTCLASS> createdObjects() {
+ ArrayList<ABSTRACTCLASS> objects = new ArrayList<ABSTRACTCLASS>();
+ Iterator it = m_objects.keySet().iterator();
while (it.hasNext()) {
- m_creators.get(it.next()).destructor_.destructor_(obj);
+ objects.add((ABSTRACTCLASS)it.next());
}
+ return objects;
}
/**
+ * {@.ja ãªãã¸ã§ã¯ãããã®ãã¡ã¯ããªã®çæç©ãã©ãã調ã¹ã}
+ * {@.en Whether a object is a product of this factory}
+ * <p>
+ * @param obj
+ * {@.ja 対象ãªãã¸ã§ã¯ã}
+ * {@.en A target object}
+ * @return
+ * {@.ja true: ãã®ãã¡ã¯ããªã®çæç©
+ * false: ãã®ãã¡ã¯ããªã®çæç©ã§ã¯ãªã}
+ * {@.en true: The object is a product of the factory
+ * false: The object is not a product of the factory}
+ *
+ */
+ public boolean isProducerOf(ABSTRACTCLASS obj) {
+ return m_objects.containsKey(obj);
+ }
+
+ /**
+ * {@.ja ãªãã¸ã§ã¯ãããã¯ã©ã¹èå¥å(ID)ãåå¾ãã}
+ * {@.en Getting class identifier (ID) from a object}
+ * <p>
+ * {@.ja å½è©²ãªãã¸ã§ã¯ãã®ã¯ã©ã¹èå¥å(ID)ãåå¾ããã}
+ * {@.en This operation returns a class identifier (ID) from a object.}
+ *
+ * @param obj [in]
+ * {@.ja ã¯ã©ã¹èå¥å(ID)ãåå¾ããããªãã¸ã§ã¯ã}
+ * {@.en An object to investigate its class ID.}
+ * @param id [out]
+ * {@.ja ã¯ã©ã¹èå¥å(ID)}
+ * {@.en Class identifier (ID)}
+ * @return
+ * {@.ja ãªã¿ã¼ã³ã³ã¼ã NOT_FOUND: èå¥åãåå¨ããªã
+ * FACTORY_OK: æ£å¸¸çµäº}
+ * {@.en Return code NOT_FOUND: ID not found
+ * FACTORY_OK: normal return}
+ */
+ public ReturnCode objectToIdentifier(ABSTRACTCLASS obj, IDENTIFIER id) {
+ if (!m_objects.containsKey(obj)) {
+ return ReturnCode.NOT_FOUND;
+ }
+ id = m_objects.get(obj).id_;
+ return ReturnCode.FACTORY_OK;
+ }
+
+ /**
+ * {@.ja ãªãã¸ã§ã¯ãã®ã³ã³ã¹ãã©ã¯ã¿ãåå¾ãã}
+ * {@.en Getting destructor of the object}
+ * <p>
+ * {@.ja ãã®ãã¡ã¯ããªã§çæããããªãã¸ã§ã¯ãã®ã³ã³ã¹ãã©ã¯ã¿ãåå¾ããã
+ * obj ã¯ãã®ãã¡ã¯ããªã§çæããããã®ã§ãªããã°ãªããªããäºã
+ * isProducerOf() é¢æ°ã§å½è©²ãªãã¸ã§ã¯ãããã®ãã¡ã¯ããªã®çæç©ã§
+ * ãããã©ããããã§ãã¯ããªããã°ãªããªãã}
+ * {@.en This operation returns a constructor of the object created by
+ * the factory. obj must be a product of the factory. User must
+ * check if the object is a product of the factory by using
+ * isProducerOf()-function, before using this function.}
+ *
+ * @return
+ * {@.ja ãªãã¸ã§ã¯ãã®ãã¹ãã©ã¯ã¿}
+ * {@.en destructor of the object}
+ *
+ */
+ public ObjectCreator objectToCreator(ABSTRACTCLASS obj) {
+ return m_objects.get(obj).creator_;
+ }
+
+ /**
+ * {@.ja ãªãã¸ã§ã¯ãã®ãã¹ãã©ã¯ã¿ãåå¾ãã}
+ * {@.en Getting destructor of the object}
+ * <p>
+ * {@.ja ãã®ãã¡ã¯ããªã§çæããããªãã¸ã§ã¯ãã®ãã¹ãã©ã¯ã¿ãåå¾ããã
+ * obj ã¯ãã®ãã¡ã¯ããªã§çæããããã®ã§ãªããã°ãªããªããäºã
+ * isProducerOf() é¢æ°ã§å½è©²ãªãã¸ã§ã¯ãããã®ãã¡ã¯ããªã®çæç©ã§
+ * ãããã©ããããã§ãã¯ããªããã°ãªããªãã}
+ * {@.en This operation returns a destructor of the object created by
+ * the factory. obj must be a product of the factory. User must
+ * check if the object is a product of the factory by using
+ * isProducerOf()-function, before using this function.}
+ *
+ * @return
+ * {@.ja ãªãã¸ã§ã¯ãã®ãã¹ãã©ã¯ã¿}
+ * {@.en destructor of the object}
+ *
+ */
+ public ObjectDestructor objectToDestructor(ABSTRACTCLASS obj) {
+ return m_objects.get(obj).destructor_;
+ }
+
+ /**
* {@.ja çæ/åé¤ã¤ã³ã¿ã¼ãã§ã¼ã¹ç®¡çç¨ã¯ã©ã¹}
* {@.en Class for creation/destruction interface management}
*/
@@ -343,8 +461,10 @@
* {@.ja åé¤ã¤ã³ã¿ã¼ãã§ã¼ã¹}
* {@.en Destruction interface}
*/
- public FactoryEntry(ObjectCreator creator,
- ObjectDestructor destructor) {
+ public FactoryEntry(IDENTIFIER id,
+ ObjectCreator creator,
+ ObjectDestructor destructor) {
+ id_ = id;
creator_ = creator;
destructor_ = destructor;
}
@@ -358,6 +478,11 @@
* {@.en Destruction interface variable}
*/
public ObjectDestructor destructor_;
+ /**
+ * {@.ja }
+ * {@.en }
+ */
+ public IDENTIFIER id_;
};
/**
* {@.ja ãªã¿ã¼ã³ã³ã¼ã}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java (from rev 670, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/LoggerConsumer.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,118 @@
+package jp.go.aist.rtm.RTC;
+
+import OpenRTM.Logger;
+import OpenRTM.LoggerHelper;
+
+import _SDOPackage.NVListHolder;
+
+import jp.go.aist.rtm.RTC.port.CorbaConsumer;
+import jp.go.aist.rtm.RTC.util.CallbackFunction;
+import jp.go.aist.rtm.RTC.util.NVUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+ /**
+ *
+ *
+ *
+ */
+public class LoggerConsumer implements SdoServiceConsumerBase, CallbackFunction, ObjectCreator<SdoServiceConsumerBase>, ObjectDestructor{
+ /**
+ * {@.ja ctor of LoggerConsumer}
+ * {@.en ctor of LoggerConsumer}
+ */
+ public LoggerConsumer(){
+ m_rtobj = null;
+ }
+
+
+ /**
+ * {@.ja åæå}
+ * {@.en Initialization}
+ */
+ public boolean init(RTObject_impl rtobj,
+ final _SDOPackage.ServiceProfile profile){
+
+ if (!m_observer.setObject(LoggerHelper.narrow(profile.service))) {
+ // narrowing failed
+ return false;
+ }
+
+ m_rtobj = rtobj;
+ m_profile = profile;
+ //
+ NVListHolder nvholder =
+ new NVListHolder(profile.properties);
+ Properties prop = new Properties();
+ NVUtil.copyToProperties(prop, nvholder);
+ return true;
+ }
+
+ /**
+ * {@.ja ååæå}
+ * {@.en Re-initialization}
+ */
+ public boolean reinit(final _SDOPackage.ServiceProfile profile){
+ if (!m_observer._ptr()._is_equivalent(profile.service)) {
+ CorbaConsumer<Logger> tmp = new CorbaConsumer<Logger>();
+ if (!tmp.setObject(profile.service)) {
+ return false;
+ }
+ m_observer.releaseObject();
+ m_observer.setObject(profile.service);
+ }
+ m_profile= profile;
+ //
+ NVListHolder nvholder =
+ new NVListHolder(profile.properties);
+ Properties prop = new Properties();
+ NVUtil.copyToProperties(prop, nvholder);
+ return true;
+ }
+
+ /**
+ * {@.ja ServiceProfile ãåå¾ãã}
+ * {@.en getting ServiceProfile}
+ */
+ public final _SDOPackage.ServiceProfile getProfile() {
+ return m_profile;
+ }
+
+ /**
+ * {@.ja çµäºå¦ç}
+ * {@.en Finalization}
+ */
+ public void finalize(){
+ }
+ //============================================================
+ // Heartbeat related functions
+ /**
+ * {@.ja }
+ * {@.en }
+ */
+ public void doOperate(){
+ }
+
+ /**
+ * <p> creator_ </p>
+ *
+ * @return Object Created instances
+ *
+ */
+ public SdoServiceConsumerBase creator_() {
+ return new ComponentObserverConsumer();
+ }
+ /**
+ * <p> destructor_ </p>
+ *
+ * @param obj The target instances for destruction
+ *
+ */
+ public void destructor_(Object obj) {
+ obj = null;
+ }
+ private RTObject_impl m_rtobj;
+ private _SDOPackage.ServiceProfile m_profile;
+ private CorbaConsumer<OpenRTM.Logger> m_observer =
+ new CorbaConsumer<OpenRTM.Logger>(OpenRTM.Logger.class);
+
+};
+
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -963,6 +963,14 @@
"exec_cxt.periodic.type",
"exec_cxt.periodic.rate",
"exec_cxt.evdriven.type",
+ "exec_cxt.sync_transition",
+ "exec_cxt.sync_activation",
+ "exec_cxt.sync_deactivation",
+ "exec_cxt.sync_reset",
+ "exec_cxt.transition_timeout",
+ "exec_cxt.activation_timeout",
+ "exec_cxt.deactivation_timeout",
+ "exec_cxt.reset_timeout",
"logger.enable",
"logger.log_level",
"naming.enable",
@@ -972,8 +980,11 @@
};
for (int ic=0; inherit_prop[ic].length() != 0; ++ic) {
- prop.setProperty(inherit_prop[ic],
- m_config.getProperty(inherit_prop[ic]));
+
+ String key = inherit_prop[ic];
+ if (m_config.findNode(key) != null) {
+ prop.setProperty(key,m_config.getProperty(key));
+ }
}
comp = factory.create(this);
@@ -2048,7 +2059,7 @@
// Get the POAManager
m_pPOAManager = m_pPOA.the_POAManager();
- m_objManager = new CorbaObjectManager(m_pORB, m_pPOA);
+ //m_objManager = new CorbaObjectManager(m_pORB, m_pPOA);
} catch (Exception ex) {
rtcout.println(Logbuf.DEBUG,
@@ -2546,7 +2557,8 @@
for (int i=0, len=m_ecs.size(); i < len; ++i) {
try {
- m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_ecs.elementAt(i)));
+ //m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_ecs.elementAt(i).getObjRef()));
+ m_pPOA.deactivate_object(m_pPOA.servant_to_id((RTC.ExecutionContextServicePOA)m_ecs.get(i)));
} catch (Exception e) {
rtcout.println(Logbuf.DEBUG, "Exception: Caught unknown Exception in Manager.shutdownComponents().");
@@ -2671,7 +2683,7 @@
Properties temp = m_config.getNode(category + "." + type_name);
Vector<String> keys = temp.propertyNames();
int length = keys.size();
- if (!(length == 1 && keys.get(length).equals("config_file"))) {
+ if (!(length == 1 && keys.get(length-1).equals("config_file"))) {
type_prop.merge(m_config.getNode(category + "." + type_name));
rtcout.println(Logbuf.INFO,
"Component type conf exists in rtc.conf. Merged.");
@@ -3105,7 +3117,7 @@
* {@.ja CORBA Object Manager}
* {@.en CORBA Object Manager}
*/
- protected CorbaObjectManager m_objManager;
+ //protected CorbaObjectManager m_objManager;
/**
* {@.ja Timer Object}
* {@.en Timer Object}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java (from rev 673, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObjectStateMachine.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,436 @@
+package jp.go.aist.rtm.RTC;
+
+import jp.go.aist.rtm.RTC.log.Logbuf;
+
+import RTC.ComponentAction;
+import RTC.ComponentActionHelper;
+import RTC.DataFlowComponentAction;
+import RTC.DataFlowComponentActionHelper;
+import RTC.FsmParticipantAction;
+import RTC.FsmParticipantActionHelper;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.MultiModeComponentAction;
+import RTC.MultiModeComponentActionHelper;
+import RTC.ReturnCode_t;
+
+public class RTObjectStateMachine {
+ private static final int NUM_OF_LIFECYCLESTATE = 4;
+ /**
+ * {@.ja ã³ã³ã¹ãã©ã¯ã¿}
+ * {@.en Constructor}
+ *
+ */
+ public RTObjectStateMachine(int id, LightweightRTObject comp){
+ m_id = id;
+ m_rtobj = (LightweightRTObject)comp._duplicate();
+ m_sm = new StateMachine<LifeCycleState,
+ RTObjectStateMachine>(NUM_OF_LIFECYCLESTATE);
+ m_ca = false;
+ m_dfc = false;
+ m_fsm = false;
+ m_mode = false;
+ m_caVar = null;
+ m_dfcVar = null;
+ m_fsmVar = null;
+ m_modeVar = null;
+ // Setting Action callback objects
+ setComponentAction(comp);
+ setDataFlowComponentAction(comp);
+ setFsmParticipantAction(comp);
+ setMultiModeComponentAction(comp);
+ // Setting callback functions to StateMachine
+ m_sm.setListener(this);
+ m_sm.setEntryAction (LifeCycleState.ACTIVE_STATE,
+ new onActivated());
+ m_sm.setDoAction (LifeCycleState.ACTIVE_STATE,
+ new onExecute());
+ m_sm.setPostDoAction(LifeCycleState.ACTIVE_STATE,
+ new onStateUpdate());
+ m_sm.setExitAction (LifeCycleState.ACTIVE_STATE,
+ new onDeactivated());
+ m_sm.setEntryAction (LifeCycleState.ERROR_STATE,
+ new onAborting());
+ m_sm.setDoAction (LifeCycleState.ERROR_STATE,
+ new onError());
+ m_sm.setExitAction (LifeCycleState.ERROR_STATE,
+ new onReset());
+ // Setting inital state
+ StateHolder<LifeCycleState> st = new StateHolder<LifeCycleState>();
+ st.prev = LifeCycleState.INACTIVE_STATE;
+ st.curr = LifeCycleState.INACTIVE_STATE;
+ st.next = LifeCycleState.INACTIVE_STATE;
+ m_sm.setStartState(st);
+ m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+ }
+ private RTObjectStateMachine(final RTObjectStateMachine rtobjsm){
+ }
+ /**
+ * {@.ja onActivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onActivated implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_ca) {
+ return;
+ }
+ if (m_caVar.on_activated(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ }
+ /**
+ * {@.ja onExecuteã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onExecute implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_dfc) {
+ return;
+ }
+ if (m_dfcVar.on_execute(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ }
+ /**
+ * {@.ja onStateUpdateã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onStateUpdate implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_dfc) {
+ return;
+ }
+ if (m_dfcVar.on_state_update(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ }
+ /**
+ * {@.ja onDeactivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onDeactivated implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_deactivated(m_id);
+ }
+ }
+ /**
+ * {@.ja onAbortingã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onAborting implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_error(m_id);
+ }
+ }
+ /**
+ * {@.ja onErrorã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onError implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_error(m_id);
+ }
+ }
+ /**
+ * {@.ja onResetã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹}
+ */
+ private class onReset implements StateAction {
+ public void doAction(StateHolder state) {
+ if (!m_ca) {
+ return;
+ }
+ if (m_caVar.on_reset(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ }
+
+
+ // functions for stored RTObject reference
+ /**
+ *
+ */
+ public LightweightRTObject getRTObject() {
+ return (LightweightRTObject)m_rtobj._duplicate();
+ }
+ /**
+ *
+ */
+ public boolean isEquivalent(LightweightRTObject comp) {
+ return m_rtobj._is_equivalent(comp);
+ }
+ /**
+ *
+ */
+ public int getExecutionContextHandle() {
+ return m_id;
+ }
+
+ // RTC::ComponentAction operations
+ /**
+ *
+ */
+ public void onStartup(){
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_startup(m_id);
+ }
+ /**
+ *
+ */
+ public void onShutdown(){
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_shutdown(m_id);
+ }
+ /**
+ *
+ */
+ public void onActivated(final StateHolder<LifeCycleState> st) {
+ if (!m_ca) {
+ return;
+ }
+ if (m_caVar.on_activated(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ *
+ */
+ public void onDeactivated(final StateHolder<LifeCycleState> st) {
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_deactivated(m_id);
+ }
+ /**
+ *
+ */
+ public void onAborting(final StateHolder<LifeCycleState> st) {
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_error(m_id);
+ }
+ /**
+ *
+ */
+ public void onError(final StateHolder<LifeCycleState> st){
+ if (!m_ca) {
+ return;
+ }
+ m_caVar.on_error(m_id);
+ }
+ /**
+ *
+ */
+ public void onReset(final StateHolder<LifeCycleState> st){
+ if (!m_ca) {
+ return;
+ }
+ if (m_caVar.on_reset(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+
+ }
+
+ // RTC::DataflowComponentAction
+ /**
+ *
+ */
+ public void onExecute(final StateHolder<LifeCycleState> st){
+ if (!m_dfc) {
+ return;
+ }
+ if (m_dfcVar.on_execute(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ *
+ */
+ public void onStateUpdate(final StateHolder<LifeCycleState> st){
+ if (!m_dfc) {
+ return;
+ }
+ if (m_dfcVar.on_state_update(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ *
+ */
+ public void onRateChanged(){
+ if (!m_dfc) {
+ return;
+ }
+ if (m_dfcVar.on_rate_changed(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+
+ // FsmParticipantAction
+ /**
+ *
+ */
+ public void onAction(final StateHolder<LifeCycleState> st){
+ if (!m_fsm) {
+ return;
+ }
+ if (m_fsmVar.on_action(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+
+ // MultiModeComponentAction
+ /**
+ *
+ */
+ public void onModeChanged(final StateHolder<LifeCycleState> st){
+ if (!m_mode) {
+ return;
+ }
+ if (m_modeVar.on_mode_changed(m_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+
+ // Getting state of the context
+ /**
+ *
+ */
+ public LifeCycleState getState(){
+ return m_sm.getState();
+ }
+ /**
+ *
+ */
+ public StateHolder<LifeCycleState> getStates(){
+ return m_sm.getStates();
+ }
+ /**
+ *
+ */
+ public boolean isCurrentState(LifeCycleState state){
+ if(getState() == state){
+ return true;
+ }
+ return false;
+ }
+ /**
+ *
+ */
+ public boolean isNextState(LifeCycleState state){
+ if(m_sm.getStates().next == state){
+ return true;
+ }
+ return false;
+ }
+ /**
+ *
+ */
+ public void goTo(LifeCycleState state){
+ m_sm.goTo(state);
+ }
+
+ // Workers
+ /**
+ *
+ */
+ public void workerPreDo(){
+ m_sm.worker_pre();
+ }
+ /**
+ *
+ */
+ public void workerDo(){
+ m_sm.worker_do();
+ }
+ /**
+ *
+ */
+ public void workerPostDo(){
+ m_sm.worker_post();
+ }
+
+ protected void setComponentAction(final LightweightRTObject comp) {
+ m_caVar = ComponentActionHelper.narrow(comp);
+ if (m_caVar!=null) {
+ m_ca = true;
+ }
+ }
+ protected void setDataFlowComponentAction(final LightweightRTObject comp){
+ m_dfcVar = DataFlowComponentActionHelper.narrow(comp);
+ if (m_dfcVar!=null) {
+ m_dfc = true;
+ }
+ }
+ protected void setFsmParticipantAction(final LightweightRTObject comp){
+ m_fsmVar = FsmParticipantActionHelper.narrow(comp);
+ if (m_fsmVar!=null) {
+ m_fsm = true;
+ }
+ }
+ protected void setMultiModeComponentAction(final LightweightRTObject comp){
+ m_modeVar = MultiModeComponentActionHelper.narrow(comp);
+ if (m_modeVar!=null) {
+ m_mode = true;
+ }
+ }
+
+ /**
+ * {@.ja ãã¬ã¼ã¹ããªã¼ã }
+ * {@.en Logger stream}
+ */
+ private Logbuf rtcout;
+ // ExecutionContext id
+ private int m_id;
+ // Associated RTObject reference
+ private LightweightRTObject m_rtobj;
+ // State machine
+ private StateMachine<LifeCycleState,
+ RTObjectStateMachine> m_sm;
+ private boolean m_ca;
+ private boolean m_dfc;
+ private boolean m_fsm;
+ private boolean m_mode;
+ private ComponentAction m_caVar;
+ private DataFlowComponentAction m_dfcVar;
+ private FsmParticipantAction m_fsmVar;
+ private MultiModeComponentAction m_modeVar;
+
+ // char dara[1000];
+ // Component action invoker
+
+}
+
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -1,10 +1,12 @@
package jp.go.aist.rtm.RTC;
import java.util.Vector;
+import java.util.Set;
import java.lang.reflect.Method;
import jp.go.aist.rtm.RTC.SDOPackage.Configuration_impl;
import jp.go.aist.rtm.RTC.executionContext.ExecutionContextBase;
+import jp.go.aist.rtm.RTC.executionContext.ExecutionContextFactory;
import jp.go.aist.rtm.RTC.port.CorbaPort;
import jp.go.aist.rtm.RTC.port.InPort;
import jp.go.aist.rtm.RTC.port.InPortBase;
@@ -657,22 +659,53 @@
String ec_args = new String();
+ String ec_type = m_properties.getProperty("exec_cxt.periodic.type");
ec_args += m_properties.getProperty("exec_cxt.periodic.type");
ec_args += "?";
ec_args += "rate=" + m_properties.getProperty("exec_cxt.periodic.rate");
+ ExecutionContextFactory<ExecutionContextBase,String> factory
+ = ExecutionContextFactory.instance();
ExecutionContextBase ec;
+ ec = factory.createObject(ec_type);
+ if (ec == null) {
+ rtcout.println(Logbuf.ERROR,"EC ("
+ + ec_type
+ + ") creation failed.");
+ Set ecs = ExecutionContextFactory.instance().getIdentifiers();
+ rtcout.println(Logbuf.DEBUG,"Available EC list: "
+ + ecs.toString() );
+ return ReturnCode_t.RTC_ERROR;
+/*
+ coil::vstring ecs;
+ ecs = RTC::ExecutionContextFactory::instance().getIdentifiers();
+ RTC_DEBUG(("Available EC list: %s",
+ coil::flatten(ecs).c_str()));
+ return RTC::RTC_ERROR;
+*/
+ }
+ rtcout.println(Logbuf.DEBUG,"EC (" + ec_type + ") created.");
+// RTC_DEBUG(("EC (%s) created.", ec_type.c_str()));
+/*
ec = Manager.instance().createContext(ec_args);
if (ec == null) {
return ReturnCode_t.RTC_ERROR;
}
- ec.set_rate(Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue());
+*/
+ //ec.getObjRef().set_rate(Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue());
m_eclist.add(ec);
ExecutionContextService ecv;
ecv = ec.getObjRef();
if (ecv == null) {
+ rtcout.println(Logbuf.ERROR,
+ "Getting object reference of ec failed.");
return ReturnCode_t.RTC_ERROR;
}
+ double ec_rate = Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue();
+ ecv.set_rate(ec_rate);
+ rtcout.println(Logbuf.DEBUG,"Execution context rate is set to "
+ + ec_rate + ".");
+
ec.bindComponent(this);
ReturnCode_t ret;
@@ -685,6 +718,7 @@
// -- entering alive state --
// at least one EC must be attached
if (m_ecMine.value.length == 0) {
+ rtcout.println(Logbuf.ERROR, "No EC of this RTC.");
return ReturnCode_t.PRECONDITION_NOT_MET;
}
for(int intIdx=0; intIdx < m_ecMine.value.length; ++intIdx) {
@@ -3915,10 +3949,16 @@
rtcout.println(Logbuf.TRACE, "RTObject_impl.finalizeContexts()");
for(int i=0, len=m_eclist.size(); i < len; ++i) {
+ m_eclist.get(i).getObjRef().stop();
try {
- m_eclist.elementAt(i).stop();
- m_eclist.elementAt(i).finalizeExecutionContext();
- m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_eclist.elementAt(i)));
+ RTC.ExecutionContextServicePOA servant;
+ servant = (RTC.ExecutionContextServicePOA)m_eclist.get(i);
+// m_eclist.elementAt(i).getObjRef().stop();
+// m_eclist.elementAt(i).finalizeExecutionContext();
+// m_pPOA.deactivate_object(m_pPOA.servant_to_id(m_eclist.elementAt(i).getObjRef()));
+ rtcout.println(Logbuf.DEBUG, "Deactivating Execution Context.");
+ m_pPOA.deactivate_object(m_pPOA.servant_to_id(servant));
+ rtcout.println(Logbuf.DEBUG, "Deactivating EC done.");
}
catch(Exception ex) {
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -412,6 +412,25 @@
}
/**
+ * {@.ja ç¶æ
ãåå¾ãã}
+ * {@.en Gets states}
+ * <p>
+ * {@.ja ç¶æ
æ
å ±ãåå¾ããã
+ * ç¾å¨ã®ç¶æ
ãï¼ã¤åã®ç¶æ
ãé·ç§»äºå®ã®ç¶æ
ãåå¾ãããã¨ãã§ããã}
+ * {@.en Get state information.
+ * Get the current state, the previous state and the next state to
+ * be expected to transfer.}
+ *
+ * @return
+ * {@.ja ç¶æ
æ
å ±}
+ * {@.en State information}
+ *
+ */
+ public StateHolder<STATE> getStates() {
+ return m_states;
+ }
+
+ /**
* {@.ja ç¾å¨ã®ç¶æ
ãåå¾ãã}
* {@.en Get current state}
*
@@ -527,7 +546,66 @@
}
}
}
+ //============================================================
+ // divided worker functions
+ // The following divided worker functions have to be used together.
+ // - worker_pre()
+ // - worker_do()
+ // - worker_post()
+ //
+ public void worker_pre() {
+ StateHolder state;
+
+ synchronized (m_states) {
+ state = new StateHolder(m_states);
+ }
+ if (state.curr == state.next) {
+ if( m_predo.get(state.curr) != null ) {
+ m_predo.get(state.curr).doAction(state);
+ }
+ return;
+ }
+ // State changed
+ if( m_exit.get(state.curr) != null ) {
+ m_exit.get(state.curr).doAction(state);
+ }
+
+ synchronized (m_states) {
+ state = new StateHolder(m_states);
+ }
+ if( state.curr != state.next ) {
+ state.curr = state.next;
+ if( m_entry.get(state.curr)!=null ) {
+ m_entry.get(state.curr).doAction(state);
+ }
+ update_curr((STATE)state.curr);
+ }
+ }
+
+ public void worker_do() {
+ StateHolder state;
+
+ synchronized (m_states) {
+ state = new StateHolder(m_states);
+ }
+ if( m_do.get(state.curr) != null ) {
+ m_do.get(state.curr).doAction(state);
+ }
+
+ }
+
+ public void worker_post() {
+ StateHolder state;
+
+ synchronized (m_states) {
+ state = new StateHolder(m_states);
+ }
+ if( m_postdo.get(state.curr) != null ) {
+ m_postdo.get(state.curr).doAction(state);
+ }
+ }
+
private boolean need_trans() {
synchronized (m_states) {
return m_states.curr != m_states.next;
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -6,28 +6,47 @@
import OpenRTM.ExtTrigExecutionContextServicePOA;
import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+import RTC.ExecutionKind;
import RTC.ReturnCode_t;
/**
* <p>Periodic Sampled Data Processing(å¨æå®è¡ç¨)ExecutionContextã®ãã¼ã¹ã¨ãªã
* æ½è±¡ã¯ã©ã¹ã§ãã</p>
*/
-public abstract class ExecutionContextBase extends
- ExtTrigExecutionContextServicePOA implements ECNewDeleteFunc {
+//public abstract class ExecutionContextBase
+// implements ECNewDeleteFunc {
+public interface ExecutionContextBase extends ECNewDeleteFunc {
/**
- * <p>ExecutionContextã®å¦çãï¼å¨æåé²ãã¾ãã</p>
+ * {@.ja ExecutionContextã¯ã©ã¹ã®åæåé¢æ°}
+ * {@.en Initialization function of ExecutionContext class}
*/
- public void tick() throws SystemException {
+ public void init(Properties props);
+/*
+ public void init(Properties props) {
}
-
+*/
/**
- * <p>æ¬ãªãã¸ã§ã¯ãã®ExecutionContextServiceã¨ãã¦ã®CORBAãªãã¸ã§ã¯ãåç
§ãè¨å®ãã¾ãã</p>
- *
- * @param ref CORBAãªãã¸ã§ã¯ãåç
§
+ * {@.ja CORBA ãªãã¸ã§ã¯ãã®è¨å®}
+ * {@.en Sets the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ããè¨å®ããã}
+ * {@.en Sets the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @param ref
+ * {@.ja ãªãã¸ã§ã¯ããªãã¡ã¬ã³ã¹}
+ * {@.en The object reference}
+ *
*/
+ public void setObjRef(final ExecutionContextService ref);
+/*
public void setObjRef(final ExecutionContextService ref) {
+ m_profile.setObjRef(ref);
}
+*/
/**
* <p> bindComponent </p>
@@ -36,16 +55,114 @@
* @return ReturnCode_t
*
*/
- public abstract ReturnCode_t bindComponent(RTObject_impl rtc);
+ public ReturnCode_t bindComponent(RTObject_impl rtc);
+// public abstract ReturnCode_t bindComponent(RTObject_impl rtc);
/**
- * <p> getObjRef </p>
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
*
- * @return ExecutionContextService
- *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
*/
- public abstract ExecutionContextService getObjRef();
+ public ExecutionContextService getObjRef();
+/*
+ public ExecutionContextService getObjRef() {
+ return m_profile.getObjRef();
+ }
+*/
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãè¨å®ãã}
+ * {@.en Set execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãè¨å®ã
+ * ããå®è¡å¨æã®å¤æ´ã¯ãDataFlowComponentAction ã®
+ * on_rate_changed ã«ãã£ã¦åRTã³ã³ãã¼ãã³ãã«ä¼éãããã}
+ * {@.en This operation shall set the rate (in hertz) at which this
+ * contextâs Active participating RTCs are being called. If the
+ * execution kind of the context is PERIODIC, a rate change shall
+ * result in the invocation of on_rate_changed on any RTCs
+ * realizing DataFlowComponentAction that are registered with any
+ * RTCs participating in the context.}
+ *
+ * @param rate
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã
+ * RTC_OK: æ£å¸¸çµäº
+ * BAD_PARAMETER: è¨å®å¤ãè² ã®å¤}
+ * {@.en The return code of ReturnCode_t type
+ * RTC_OK: Succeed
+ * BAD_PARAMETER: Invalid value. The value might be negative.}
+ *
+ */
+ public ReturnCode_t setRate(double rate);
+/*
+ public ReturnCode_t setRate(double rate) {
+ return m_profile.setRate(rate);
+ }
+*/
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãåå¾ãã}
+ * {@.en Get execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãåå¾ã
+ * ãã}
+ * {@.en This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.}
+ *
+ * @return
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ */
+ public double getRate();
+/*
+ public double getRate() {
+ return m_profile.getRate();
+ }
+*/
+ /**
+ * {@.ja ExecutionKind ãæåååãã}
+ * {@.en Converting ExecutionKind enum to string}
+ * <p>
+ * {@.ja RTC::ExecutionKind ã§å®ç¾©ããã¦ãã PERIODIC, EVENT_DRIVEN,
+ * OTHER ãæåååããã}
+ * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+ * OTHER) defined in RTC::ExecutionKind to string.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ * @return
+ * {@.ja æåååãããExecutionKind}
+ * {@.en String of ExecutionKind}
+ *
+ */
+ public String getKindString(ExecutionKind kind);
+/*
+ public final String getKindString(ExecutionKind kind) {
+ return m_profile.getKindString(kind);
+ }
+*/
+ public boolean finalizeExecutionContext();
+// public abstract boolean finalizeExecutionContext();
+/*
+ public ExecutionContextProfile m_profile
+ = new ExecutionContextProfile();
+*/
+/*
+ protected ExecutionContextProfile m_profile
+ = new ExecutionContextProfile();
+*/
- public abstract boolean finalizeExecutionContext();
-
}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextFactory.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,34 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import jp.go.aist.rtm.RTC.FactoryGlobal;
+/**
+ * {@.ja ExecutionContextç¨ãã¡ã¯ããªã®å®è£
}
+ * {@.en Implement of factory for ExecutionContext}
+ */
+
+public class ExecutionContextFactory<ABSTRACTCLASS,IDENTIFIER> extends FactoryGlobal<ABSTRACTCLASS,IDENTIFIER> {
+
+ /**
+ * {@.ja ã³ã³ã¹ãã©ã¯ã¿ã}
+ * {@.en Constructor}
+ */
+ private ExecutionContextFactory() {
+
+ }
+ /**
+ * {@.ja ã¤ã³ã¹ã¿ã³ã¹çæã}
+ * {@.en Create instance}
+ *
+ * <p>
+ * {@.ja ã¤ã³ã¹ã¿ã³ã¹ãçæããã}
+ *
+ * @return
+ * {@.ja ã¤ã³ã¹ã¿ã³ã¹}
+ * {@.en ExecutionContextFactory object}
+ *
+ */
+ public static ExecutionContextFactory instance() {
+ return (ExecutionContextFactory)instance("jp.go.aist.rtm.RTC.executionContext.ExecutionContextFactory");
+ }
+}
+
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,571 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
+import jp.go.aist.rtm.RTC.util.equalFunctor;
+import jp.go.aist.rtm.RTC.util.NVUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.TimeValue;
+import RTC.ExecutionContextService;
+//import RTC.ExecutionContextProfile;
+import RTC.ExecutionKind;
+import RTC.ExecutionKindHolder;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
+import RTC.RTCListHolder;
+import RTC.RTObject;
+import RTC.RTObjectHelper;
+import _SDOPackage.NVListHolder;
+ /**
+ * {@.ja ExecutionContextProfile ã¯ã©ã¹}
+ * {@.en ExecutionContextProfile class}
+ * <p>
+ * {@.ja Periodic Sampled Data Processing(å¨æå®è¡ç¨)ExecutionContextã¯ã©ã¹ã}
+ * {@.en Periodic Sampled Data Processing (for the execution cycles)
+ * ExecutionContext class}
+ */
+public class ExecutionContextProfile {
+ public static final double DEEFAULT_PERIOD = 0.000001;
+
+ /**
+ * {@.ja ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿}
+ * {@.en Default Constructor}
+ * <p>
+ * {@.ja ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
+ * ãããã¡ã¤ã«ã«ä»¥ä¸ã®é
ç®ãè¨å®ããã
+ * - kind : PERIODIC
+ * - rate : 0.0}
+ * {@.en Default Constructor
+ * Set the following items to profile.
+ * - kind : PERIODIC
+ * - rate : 0.0}
+ */
+ public ExecutionContextProfile(ExecutionKind kind) {
+ rtcout = new Logbuf("periodic_ecprofile");
+ m_period = new TimeValue(DEEFAULT_PERIOD);
+ m_ref = null;
+ rtcout.println(Logbuf.TRACE, "ExecutionContextProfile()");
+ rtcout.println(Logbuf.DEBUG, "Actual rate: "
+ + m_period.sec()
+ + " [sec], "
+ + m_period.usec()
+ + " [usec]");
+ // profile initialization
+ m_profile.kind = kind;
+ m_profile.rate = 1.0 / m_period.toDouble();
+ m_profile.owner = null;
+ m_profile.participants = new RTObject[0];
+ m_profile.properties = new _SDOPackage.NameValue[0];
+ }
+ public ExecutionContextProfile(){
+ this(ExecutionKind.PERIODIC);
+ }
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãã®è¨å®}
+ * {@.en Sets the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ããè¨å®ããã}
+ * {@.en Sets the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @param ec_ptr
+ * {@.ja ãªãã¸ã§ã¯ããªãã¡ã¬ã³ã¹}
+ * {@.en The object reference}
+ */
+ public void setObjRef(ExecutionContextService ec_ptr){
+ rtcout.println(Logbuf.TRACE, "setObjRef()");
+ synchronized (m_profile){
+ m_ref = (ExecutionContextService)ec_ptr._duplicate();
+ }
+ }
+
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
+ */
+ public ExecutionContextService getObjRef(){
+ rtcout.println(Logbuf.TRACE, "getObjRef()");
+ synchronized (m_profile){
+ return (ExecutionContextService)m_ref._duplicate();
+ }
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãè¨å®ãã}
+ * {@.en Set execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãè¨å®ã
+ * ããå®è¡å¨æã®å¤æ´ã¯ãDataFlowComponentAction ã®
+ * on_rate_changed ã«ãã£ã¦åRTã³ã³ãã¼ãã³ãã«ä¼éãããã}
+ * {@.en This operation shall set the rate (in hertz) at which this
+ * contextâs Active participating RTCs are being called. If the
+ * execution kind of the context is PERIODIC, a rate change shall
+ * result in the invocation of on_rate_changed on any RTCs
+ * realizing DataFlowComponentAction that are registered with any
+ * RTCs participating in the context.}
+ *
+ * @param rate
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã
+ * RTC_OK: æ£å¸¸çµäº
+ * BAD_PARAMETER: è¨å®å¤ãè² ã®å¤}
+ * {@.en The return code of ReturnCode_t type
+ * RTC_OK: Succeed
+ * BAD_PARAMETER: Invalid value. The value might be negative.}
+ *
+ */
+ public ReturnCode_t setRate(double rate) {
+ rtcout.println(Logbuf.TRACE, "set_rate("+rate+")");
+ if (rate < 0.0) {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ synchronized (m_profile){
+ m_profile.rate = rate;
+ m_period = new TimeValue(1.0/rate);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ public ReturnCode_t setPeriod(double period) {
+ rtcout.println(Logbuf.TRACE, "setPeriod("+period+" [sec])");
+ if (period < 0.0) {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ synchronized (m_profile){
+ m_profile.rate = 1.0 / period;
+ m_period = new TimeValue(period);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ public ReturnCode_t setPeriod(TimeValue period) {
+ rtcout.println(Logbuf.TRACE, "setPeriod("+period.toDouble()+" [sec])");
+ if (period.toDouble() < 0.0) {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ synchronized (m_profile){
+ m_profile.rate = 1.0 / period.toDouble();
+ m_period = period;
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãåå¾ãã}
+ * {@.en Get execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãåå¾ã
+ * ãã}
+ * {@.en This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.}
+ *
+ * @return
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ */
+ public double getRate() {
+ rtcout.println(Logbuf.TRACE, "get_rate()");
+ synchronized (m_profile){
+ return m_profile.rate;
+ }
+ }
+ public TimeValue getPeriod(){
+ rtcout.println(Logbuf.TRACE, "getPeriod()");
+ synchronized (m_profile){
+ return m_period;
+ }
+ }
+
+ /**
+ * {@.ja ExecutionKind ãæåååãã}
+ * {@.en Converting ExecutionKind enum to string }
+ * <p>
+ * {@.ja ExecutionKind ã§å®ç¾©ããã¦ãã PERIODIC, EVENT_DRIVEN,
+ * OTHER ãæåååããã}
+ * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+ * OTHER) defined in RTC::ExecutionKind to string.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ * @return
+ * {@.en æåååãããExecutionKind}
+ * {@.en String of ExecutionKind}
+ *
+ */
+ public final String getKindString(ExecutionKind kind){
+ ExecutionKindHolder ekh = new ExecutionKindHolder(kind);
+ try {
+ return ekh._type().name();
+ }
+ catch(Exception ex) {
+ return "";
+ }
+ }
+ public final String getKindString() {
+ return getKindString(m_profile.kind);
+ }
+
+ /**
+ * {@.ja ExecutionKind ãè¨å®ãã}
+ * {@.en Set the ExecutionKind}
+ * <p>
+ * {@.ja ãã® ExecutionContext ã® ExecutionKind ãè¨å®ãã}
+ * {@.en This operation sets the kind of the execution context.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ *
+ */
+ public ReturnCode_t setKind(ExecutionKind kind) {
+ rtcout.println(Logbuf.TRACE, "setKind("+getKindString(kind)+")");
+ synchronized (m_profile){
+ m_profile.kind = kind;
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+
+ /**
+ * {@.ja ExecutionKind ãåå¾ãã}
+ * {@.en Get the ExecutionKind}
+ * <p>
+ * {@.ja æ¬ ExecutionContext ã® ExecutionKind ãåå¾ãã}
+ * {@.en This operation shall report the execution kind of the execution
+ * context.}
+ *
+ * @return
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ */
+ public ExecutionKind getKind() {
+ rtcout.println(Logbuf.TRACE, getKindString(m_profile.kind)
+ + " = getKind()");
+ return m_profile.kind;
+ }
+
+ /**
+ * {@.ja Ownerã³ã³ãã¼ãã³ããã»ããããã}
+ * {@.en Setting owner component of the execution context}
+ * <p>
+ * {@.ja ãã®ECã®Ownerã¨ãªãRTCãã»ããããã}
+ * {@.en This function sets an RT-Component to be owner of the
+ * execution context.}
+ *
+ * @param comp
+ * {@.ja Ownerã¨ãªãRTã³ã³ãã¼ãã³ã}
+ * {@.en an owner RT-Component of this execution context}
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t setOwner(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE, "setOwner()");
+ if (comp==null) {
+ rtcout.println(Logbuf.ERROR,"nil reference is given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ RTObject rtobj;
+ rtobj = RTObjectHelper.narrow(comp);
+ if (rtobj==null) {
+ rtcout.println(Logbuf.ERROR,"Narrowing failed.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ m_profile.owner = (RTObject)rtobj._duplicate();
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja Ownerã³ã³ãã¼ãã³ãã®åç
§ãåå¾ãã}
+ * {@.en Getting a reference of the owner component}
+ * <p>
+ * {@.ja ãã®ECã®Ownerã§ããRTCã®åç
§ãåå¾ããã}
+ * {@.en This function returns a reference of the owner RT-Component of
+ * this execution context}
+ *
+ * @return
+ * {@.ja OwnerRTã³ã³ãã¼ãã³ãã®åç
§}
+ * {@.en a reference of the owner RT-Component}
+ */
+ public final RTObject getOwner() {
+ rtcout.println(Logbuf.TRACE, "getOwner()");
+ return (RTObject)m_profile.owner._duplicate();
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãã追å ãã}
+ * {@.en Add an RT-component}
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«è¿½å ããã追å ãããRTã³
+ * ã³ãã¼ãã³ã㯠attach_context ãå¼ã°ããInactive ç¶æ
ã«é·ç§»ããã
+ * æå®ãããRTã³ã³ãã¼ãã³ããnullã®å ´åã¯ãBAD_PARAMETER ãè¿ãã
+ * ããæå®ãããRTã³ã³ãã¼ãã³ãã DataFlowComponent 以å¤ã®å ´åã¯ã
+ * BAD_PARAMETER ãè¿ãããã}
+ * {@.en The operation causes the given RTC to begin participating in
+ * the execution context. The newly added RTC will receive a call
+ * to LightweightRTComponent::attach_context and then enter the
+ * Inactive state. BAD_PARAMETER will be invoked, if the given
+ * RT-Component is null or if the given RT-Component is other than
+ * DataFlowComponent.}
+ *
+ * @param comp
+ * {@.ja 追å 対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for add}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t addComponent(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE,"addComponent()");
+ if (comp==null) {
+ rtcout.println(Logbuf.ERROR,"A nil reference was given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ RTObject rtobj = RTObjectHelper.narrow(comp);
+ if (rtobj==null) {
+ rtcout.println(Logbuf.ERROR,"Narrowing was failed.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ RTCListHolder holder = new RTCListHolder(m_profile.participants);
+ CORBA_SeqUtil.push_back(holder, rtobj);
+ m_profile.participants = holder.value;
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãã}
+ * {@.en Remove the RT-Component from participant list}
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãããåé¤ããã
+ * RTã³ã³ãã¼ãã³ã㯠detach_context ãå¼ã°ãããæå®ãããRTã³ã³ãã¼
+ * ãã³ããåå è
ãªã¹ãã«ç»é²ããã¦ããªãå ´åã¯ãBAD_PARAMETER ãè¿
+ * ãããã}
+ * {@.en This operation causes a participant RTC to stop participating
+ * in the execution context.
+ * The removed RTC will receive a call to
+ * LightweightRTComponent::detach_context.
+ * BAD_PARAMETER will be returned, if the given RT-Component is not
+ * participating in the participant list.}
+ *
+ * @param comp
+ * {@.ja åé¤å¯¾è±¡RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for delete}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t removeComponent(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE,"removeComponent()");
+ if (comp==null) {
+ rtcout.println(Logbuf.ERROR,"A nil reference was given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ RTObject rtobj = RTObjectHelper.narrow(comp);
+ if (rtobj==null) {
+ rtcout.println(Logbuf.ERROR,"Narrowing was failed.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ synchronized (m_profile) {
+ RTCListHolder holder = new RTCListHolder(m_profile.participants);
+ int index;
+ index = CORBA_SeqUtil.find(holder,
+ new find_participant(rtobj));
+ if (index < 0) {
+ rtcout.println(Logbuf.ERROR,
+ "The given RTObject does not exist in the EC.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ CORBA_SeqUtil.erase(holder, index);
+ m_profile.participants = holder.value;
+ }
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãã®åå è
ãªã¹ããåå¾ãã}
+ * {@.en Getting participant RTC list}
+ * <p>
+ * {@.ja ç¾å¨ç»é²ããã¦ããåå è
RTCã®ãªã¹ããåå¾ããã}
+ * {@.en This function returns a list of participant RTC of the
+ * execution context.}
+ *
+ * @return
+ * {@.ja åå è
RTCã®ãªã¹ã}
+ * {@.en Participants RTC list}
+ *
+ */
+ public final RTObject[] getComponentList() {
+ rtcout.println(Logbuf.TRACE,"getComponentList("
+ + m_profile.participants.length
+ +")");
+ return m_profile.participants;
+ }
+
+ /**
+ * {@.ja Propertiesãã»ãããã}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties ãã»ããããã}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ * @param props
+ * {@.ja ExecutionContextProfile::properties ã«ã»ããããããããã£ã¼}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ */
+ public void setProperties(Properties props) {
+ rtcout.println(Logbuf.TRACE,"setProperties()");
+ String str = new String();
+ str = props._dump(str,props,0);
+ rtcout.println(Logbuf.TRACE,str);
+ synchronized (m_profile) {
+ NVListHolder holder = new NVListHolder(m_profile.properties);
+ NVUtil.copyFromProperties(holder, props);
+ m_profile.properties = holder.value;
+ }
+ }
+
+ /**
+ * {@.ja Propertiesãåå¾ãã}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties ãåå¾ããã}
+ *
+ * @return
+ * {@.ja Propertiesã«å¤æãããExecutionContextProfile::properties}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ */
+ public final Properties getProperties() {
+ rtcout.println(Logbuf.TRACE,"getProperties()");
+ Properties props = new Properties();
+ synchronized (m_profile) {
+ NVListHolder holder = new NVListHolder(m_profile.properties);
+ NVUtil.copyToProperties(props, holder);
+ String str = new String();
+ str = props._dump(str,props,0);
+ rtcout.println(Logbuf.TRACE,str);
+ }
+ return props;
+ }
+
+ /**
+ * {@.ja Profileãåå¾ãã}
+ * {@.en Getting Profile}
+ * <p>
+ * {@.ja RTC::ExecutionContextProfile ãåå¾ãããåå¾ãã
+ * ExecutionContextProfile ã®ææ権ã¯å¼ã³åºãå´ã«ãããåå¾ããããª
+ * ãã¸ã§ã¯ããä¸è¦ã«ãªã£ãå ´åãå¼ã³åºãå´ãéæ¾ãã責任ãè² ãã}
+ * {@.en This function gets RTC::ExecutionContextProfile. The ownership
+ * of the obtained ExecutionContextProfile is given to caller. The
+ * caller should release obtained object when it is unneccessary
+ * anymore.}
+ *
+ * @return
+ * {@.ja RTC::ExecutionContextProfile}
+ * {@.en RTC::ExecutionContextProfile}
+ *
+ */
+ public RTC.ExecutionContextProfile getProfile() {
+ rtcout.println(Logbuf.TRACE,"getProfile()");
+ RTC.ExecutionContextProfile p;
+ synchronized (m_profile){
+ p = new RTC.ExecutionContextProfile(m_profile.kind,
+ m_profile.rate,
+ m_profile.owner,
+ m_profile.participants,
+ m_profile.properties);
+ }
+ return p;
+
+ }
+
+
+ /**
+ * {@.ja ExecutionContextProfileãããã¯ãã}
+ * {@.en Getting a lock of RTC::ExecutionContextProfile}
+ * <p>
+ * {@.ja ãã®ãªãã¸ã§ã¯ãã管çãã RTC::ExecutionContextProfile ãããã¯ããã
+ * ããã¯ãä¸è¦ã«ãªã£ãéã«ã¯unlock()ã§ããã¯ã解é¤ããªããã°ãªããªãã}
+ * {@.en This function locks RTC::ExecutionContextProfile in the object.
+ * The lock should be released when the lock is unneccessary.}
+ *
+ */
+ public void lock() {
+ //m_profileMutex.lock();
+ }
+
+ /**
+ * {@.ja ExecutionContextProfileãã¢ã³ããã¯ãã}
+ * {@.en Release a lock of the RTC::ExecutionContextProfile}
+ * <p>
+ * {@.ja ãã®ãªãã¸ã§ã¯ãã管çãã RTC::ExecutionContextProfile ãã¢ã³ãã
+ * ã¯ããã}
+ * {@.en This function release the lock of RTC::ExecutionContextProfile
+ * in the object.}
+ *
+ */
+ public void unlock() {
+ //m_profileMutex.unlock();
+ }
+
+ /**
+ * {@.ja Logger}
+ * {@.en Logger}
+ */
+ private Logbuf rtcout;
+ /**
+ * {@.ja ECProfile}
+ * {@.en ECProfile}
+ */
+ private RTC.ExecutionContextProfile m_profile
+ = new RTC.ExecutionContextProfile();
+
+ /**
+ * {@.ja mutex of ExecutionContextProfile}
+ * {@.en mutex ExecutionContextProfile}
+ */
+ //private String m_profileMutex = new String();
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ}
+ * {@.en Execution cycle of ExecutionContext}
+ */
+ private TimeValue m_period;
+
+ /**
+ * {@.ja ExecutionContextService ãªãã¸ã§ã¯ãã¸ã®åç
§}
+ * {@.en Reference to ExecutionContextService object}
+ */
+ private ExecutionContextService m_ref;
+
+ private class find_participant implements equalFunctor {
+ private RTObject m_comp;
+ public find_participant(RTObject comp) {
+ m_comp = (RTObject)comp._duplicate();
+ }
+ public boolean equalof(final java.lang.Object comp) {
+ return m_comp._is_equivalent((RTObject)comp);
+ }
+ };
+}; // class ExecutionContextProfile
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java (from rev 673, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,700 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.RTObjectStateMachine;
+import jp.go.aist.rtm.RTC.util.TimeValue;
+import jp.go.aist.rtm.RTC.log.Logbuf;
+
+import RTC.ExecutionContextService;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
+ /**
+ * {@.ja PeriodicExecutionContext ã¯ã©ã¹}
+ * {@.en PeriodicExecutionContext class}
+ * <p>
+ * {@.ja Periodic Sampled Data Processing(å¨æå®è¡ç¨)ExecutionContextã¯ã©ã¹ã}
+ * {@.en Periodic Sampled Data Processing (for the execution cycles)
+ * ExecutionContext class}
+ */
+public class ExecutionContextWorker {
+
+ /**
+ * {@.ja ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿}
+ * {@.en Default Constructor}
+ * <p>
+ * {@.ja ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
+ * ãããã¡ã¤ã«ã«ä»¥ä¸ã®é
ç®ãè¨å®ããã
+ * - kind : PERIODIC
+ * - rate : 0.0}
+ * {@.en Default Constructor
+ * Set the following items to profile.
+ * - kind : PERIODIC
+ * - rate : 0.0}
+ */
+ public ExecutionContextWorker() {
+ rtcout = new Logbuf("ec_worker");
+ m_running = false;
+ rtcout.println(Logbuf.TRACE, "ExecutionContextWorker()");
+ }
+ //============================================================
+ // Object reference to EC
+ //============================================================
+ public void setECRef(ExecutionContextService ref) {
+ m_ref = (ExecutionContextService)ref._duplicate();
+ }
+ public ExecutionContextService getECRef(){
+ return (ExecutionContextService)m_ref._duplicate();
+ }
+
+ //============================================================
+ // ExecutionContext
+ //============================================================
+ /**
+ * {@.ja ExecutionContext å®è¡ç¶æ
確èªé¢æ°}
+ * {@.en Check for ExecutionContext running state}
+ * <p>
+ * {@.ja ãã®æä½ã¯ ExecutionContext ã Runnning ç¶æ
ã®å ´åã« true ãè¿ãã
+ * Executioncontext ã Running ã®éãå½è©² Executioncontext ã«åå ã
+ * ã¦ããå
¨ã¦ã®ã¢ã¯ãã£ãRTã³ã³ãã¼ãã³ãããExecutionContext ã®å®
+ * è¡ç¨®é¡ã«å¿ãã¦å®è¡ãããã}
+ * {@.en This operation shall return true if the context is in the
+ * Running state. While the context is Running, all Active RTCs
+ * participating in the context shall be executed according to the
+ * contextâs execution kind.}
+ *
+ * @return
+ * {@.ja ç¶æ
確èªé¢æ°(åä½ä¸:trueãåæ¢ä¸:false)}
+ * {@.en Check state function (Running:trueãStopping:false)}
+ *
+ */
+ public boolean isRunning() {
+ rtcout.println(Logbuf.TRACE, "isRunning()");
+ return m_running;
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡ãéå§}
+ * {@.en Start the ExecutionContext}
+ * <p>
+ * {@.ja ExecutionContext ã®å®è¡ç¶æ
ã Runnning ã¨ããããã®ãªã¯ã¨ã¹ãã
+ * çºè¡ãããExecutionContext ã®ç¶æ
ãé·ç§»ããã¨
+ * ComponentAction::on_startup ãå¼ã³åºããããåå ãã¦ããRTã³ã³ãã¼
+ * ãã³ãããåæåãããã¾ã§ ExecutionContext ãéå§ãããã¨ã¯ã§ã
+ * ãªããExecutionContext ã¯è¤æ°åéå§/åæ¢ãç¹°ãè¿ããã¨ãã§ããã}
+ * {@.en Request that the context enter the Running state. Once the
+ * state transition occurs, the ComponentAction::on_startup
+ * operation will be invoked. An execution context may not be
+ * started until the RT-Components that participate in it have
+ * been initialized. An execution context may be started and
+ * stopped multiple times.}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t start() {
+ rtcout.println(Logbuf.TRACE, "start()");
+ synchronized (m_mutex){
+ if (m_running) {
+ rtcout.println(Logbuf.WARN,
+ "ExecutionContext is already running.");
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ // invoke ComponentAction::on_startup for each comps.
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ m_comps.get(ic).onStartup();
+ }
+ rtcout.println(Logbuf.DEBUG, m_comps.size()
+ + " components started.");
+ // change EC thread state
+ m_running = true;
+
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡ãåæ¢}
+ * {@.en Stop the ExecutionContext}
+ * <p>
+ * {@.ja ExecutionContext ã®ç¶æ
ã Stopped ã¨ããããã®ãªã¯ã¨ã¹ããçºè¡ã
+ * ããé·ç§»ãçºçããå ´åã¯ãComponentAction::on_shutdown ãå¼ã³åº
+ * ããããåå ãã¦ããRTã³ã³ãã¼ãã³ããçµäºããåã«
+ * ExecutionContext ãåæ¢ããå¿
è¦ããããExecutionContext ã¯è¤æ°å
+ * éå§/åæ¢ãç¹°ãè¿ããã¨ãã§ããã}
+ * {@.en Request that the context enter the Stopped state. Once the
+ * transition occurs, the ComponentAction::on_shutdown operation
+ * will be invoked. An execution context must be stopped before
+ * the RT components that participate in it are finalized. An
+ * execution context may be started and stopped multiple times.}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t stop(){
+ rtcout.println(Logbuf.TRACE, "stop()");
+ synchronized (m_mutex){
+ if (!m_running) {
+ rtcout.println(Logbuf.WARN,
+ "ExecutionContext is already stopped.");
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ // stop thread
+ m_running = false;
+
+ // invoke on_shutdown for each comps.
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ m_comps.get(ic).onShutdown();
+ }
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ããã¢ã¯ãã£ãåãã}
+ * {@.en Activate an RT-component}
+ * <p>
+ * {@.ja Inactive ç¶æ
ã«ããRTã³ã³ãã¼ãã³ããActive ã«é·ç§»ãããã¢ã¯ãã£
+ * ãåããããã®æä½ãå¼ã°ããçµæãon_activate ãå¼ã³åºããããæ
+ * å®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«å«ã¾ããªãå ´åã¯ã
+ * BAD_PARAMETER ãè¿ããããæå®ããRTã³ã³ãã¼ãã³ãã®ç¶æ
ã
+ * Inactive 以å¤ã®å ´åã¯ãPRECONDITION_NOT_MET ãè¿ãããã}
+ * {@.en The given participant RTC is Inactive and is therefore not
+ * being invoked according to the execution contextâs execution
+ * kind. This operation shall cause the RTC to transition to the
+ * Active state such that it may subsequently be invoked in this
+ * execution context. The callback on_activate shall be called as
+ * a result of calling this operation. This operation shall not
+ * return until the callback has returned, and shall result in an
+ * error if the callback does.}
+ *
+ * @param comp
+ * {@.ja ã¢ã¯ãã£ãå対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for activation}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t activateComponent(LightweightRTObject comp,
+ RTObjectStateMachine rtobj) {
+ rtcout.println(Logbuf.TRACE, "activateComponent()");
+ synchronized (m_mutex){
+ RTObjectStateMachine obj = findComponent(comp);
+ if (obj == null) {
+ rtcout.println(Logbuf.ERROR,
+ "Given RTC is not participant of this EC.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ rtcout.println(Logbuf.DEBUG, "Component found in the EC.");
+ if (!(obj.isCurrentState(LifeCycleState.INACTIVE_STATE))) {
+ rtcout.println(Logbuf.ERROR,
+ "State of the RTC is not INACTIVE_STATE.");
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ rtcout.println(Logbuf.DEBUG,
+ "Component is in INACTIVE state. Going to ACTIVE state.");
+ obj.goTo(LifeCycleState.ACTIVE_STATE);
+ rtobj = obj;
+ rtcout.println(Logbuf.DEBUG,"activateComponent() done.");
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout,
+ long cycle) {
+ return ReturnCode_t.RTC_OK;
+ }
+ public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj) {
+ return waitActivateComplete(rtobj,new TimeValue(1.0),1000);
+ }
+ public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout ) {
+ return waitActivateComplete(rtobj,timeout,1000);
+ };
+ public ReturnCode_t waitActivateComplete(RTObjectStateMachine rtobj,
+ long cycle) {
+ return waitActivateComplete(rtobj,new TimeValue(1.0),cycle);
+ }
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ããéã¢ã¯ãã£ãåãã}
+ * {@.en Deactivate an RT-component}
+ * <p>
+ * {@.ja Inactive ç¶æ
ã«ããRTã³ã³ãã¼ãã³ããéã¢ã¯ãã£ãåããInactive
+ * ã«é·ç§»ãããããã®æä½ãå¼ã°ããçµæãon_deactivate ãå¼ã³åºãã
+ * ããæå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«å«ã¾ããªãå ´åã¯ã
+ * BAD_PARAMETER ãè¿ããããæå®ããRTã³ã³ãã¼ãã³ãã®ç¶æ
ã
+ * Active 以å¤ã®å ´åã¯ãPRECONDITION_NOT_MET ãè¿ãããã}
+ * {@.en The given RTC is Active in the execution context. Cause it to
+ * transition to the Inactive state such that it will not be
+ * subsequently invoked from the context unless and until it is
+ * activated again. The callback on_deactivate shall be called as
+ * a result of calling this operation. This operation shall not
+ * return until the callback has returned, and shall result in an
+ * error if the callback does.}
+ *
+ * @param comp
+ * {@.ja éã¢ã¯ãã£ãå対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for deactivate}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t deactivateComponent(LightweightRTObject comp,
+ RTObjectStateMachine rtobj){
+ rtcout.println(Logbuf.TRACE, "deactivateComponent()");
+ synchronized (m_mutex){
+ rtobj = findComponent(comp);
+ if (rtobj == null) {
+ rtcout.println(Logbuf.ERROR,
+ "Given RTC is not participant of this EC.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ if (!(rtobj.isCurrentState(LifeCycleState.ACTIVE_STATE))) {
+ rtcout.println(Logbuf.ERROR,
+ "State of the RTC is not ACTIVE_STATE.");
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ rtobj.goTo(LifeCycleState.INACTIVE_STATE);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout,
+ long cycle) {
+ return ReturnCode_t.RTC_OK;
+ }
+ public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout) {
+ return waitDeactivateComplete(rtobj,timeout,1000);
+ }
+ public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj,
+ long cycle){
+ return waitDeactivateComplete(rtobj,new TimeValue(1.0),cycle);
+ }
+ public ReturnCode_t waitDeactivateComplete(RTObjectStateMachine rtobj){
+ return waitDeactivateComplete(rtobj, new TimeValue(1.0),1000);
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãããªã»ãããã}
+ * {@.en Reset the RT-component}
+ * <p>
+ * {@.ja Error ç¶æ
ã®RTã³ã³ãã¼ãã³ãã®å¾©å¸°ã試ã¿ãããã®æä½ãå¼ã°ããçµ
+ * æãon_reset ãå¼ã³åºããããæå®ããRTã³ã³ãã¼ãã³ããåå è
ãª
+ * ã¹ãã«å«ã¾ããªãå ´åã¯ãBAD_PARAMETER ãè¿ããããæå®ããRTã³ã³
+ * ãã¼ãã³ãã®ç¶æ
ã Error 以å¤ã®å ´åã¯ãPRECONDITION_NOT_MET ãè¿
+ * ãããã}
+ * {@.en Attempt to recover the RTC when it is in Error. The
+ * ComponentAction::on_reset callback shall be invoked. This
+ * operation shall not return until the callback has returned, and
+ * shall result in an error if the callback does. If possible, the
+ * RTC developer should implement that callback such that the RTC
+ * may be returned to a valid state.}
+ *
+ * @param comp
+ * {@.ja ãªã»ãã対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for reset}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t resetComponent(LightweightRTObject comp,
+ RTObjectStateMachine rtobj) {
+ rtcout.println(Logbuf.TRACE, "resetComponent()");
+ synchronized (m_mutex){
+
+ rtobj = findComponent(comp);
+ if (rtobj == null) {
+ rtcout.println(Logbuf.ERROR,
+ "Given RTC is not participant of this EC.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ if (!(rtobj.isCurrentState(LifeCycleState.ERROR_STATE))) {
+ rtcout.println(Logbuf.ERROR,
+ "State of the RTC is not ERROR_STATE.");
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ rtobj.goTo(LifeCycleState.INACTIVE_STATE);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout,
+ long cycle) {
+ return ReturnCode_t.RTC_OK;
+ }
+ public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+ TimeValue timeout){
+ return waitResetComplete(rtobj, timeout, 1000);
+ }
+ public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj,
+ long cycle) {
+ return waitResetComplete(rtobj, new TimeValue(1.0), cycle);
+ }
+ public ReturnCode_t waitResetComplete(RTObjectStateMachine rtobj) {
+ return waitResetComplete(rtobj, new TimeValue(1.0), 1000);
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãã®ç¶æ
ãåå¾ãã}
+ * {@.en Get RT-component's state}
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ãã®ç¶æ
(LifeCycleState)ãåå¾ãããæå®ã
+ * ãRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«å«ã¾ããªãå ´åã¯ã
+ * UNKNOWN_STATE ãè¿ãããã}
+ * {@.en This operation shall report the LifeCycleState of the given
+ * participant RTC. UNKNOWN_STATE will be returned, if the given
+ * RT-Component is not inclued in the participant list.}
+ *
+ * @param comp
+ * {@.ja ç¶æ
åå¾å¯¾è±¡RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component to get the state}
+ *
+ * @return
+ * {@.ja ç¾å¨ã®ç¶æ
(LifeCycleState)}
+ * {@.en The current state of the target RT-Component(LifeCycleState)}
+ *
+ */
+ public LifeCycleState getComponentState(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE, "getComponentState()");
+ synchronized (m_mutex){
+ RTObjectStateMachine rtobj = findComponent(comp);
+ if (rtobj == null) {
+ rtcout.println(Logbuf.WARN,
+ "Given RTC is not participant of this EC.");
+ return LifeCycleState.CREATED_STATE;
+ }
+ LifeCycleState state = rtobj.getState();
+ rtcout.println(Logbuf.DEBUG,
+ "getComponentState() = "
+ + getStateString(state)
+ + " done" );
+ return state;
+ }
+ }
+ public final String getStateString(LifeCycleState state) {
+ final String st[] = {
+ "CREATED_STATE",
+ "INACTIVE_STATE",
+ "ACTIVE_STATE",
+ "ERROR_STATE"
+ };
+ return st[state.value()];
+ }
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãã追å ãã}
+ * {@.en Add an RT-component}
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«è¿½å ããã追å ãããRTã³
+ * ã³ãã¼ãã³ã㯠attach_context ãå¼ã°ããInactive ç¶æ
ã«é·ç§»ããã
+ * æå®ãããRTã³ã³ãã¼ãã³ããnullã®å ´åã¯ãBAD_PARAMETER ãè¿ãã
+ * ããæå®ãããRTã³ã³ãã¼ãã³ãã DataFlowComponent 以å¤ã®å ´åã¯ã
+ * BAD_PARAMETER ãè¿ãããã}
+ * {@.en The operation causes the given RTC to begin participating in
+ * the execution context. The newly added RTC will receive a call
+ * to LightweightRTComponent::attach_context and then enter the
+ * Inactive state. BAD_PARAMETER will be invoked, if the given
+ * RT-Component is null or if the given RT-Component is other than
+ * DataFlowComponent.}
+ *
+ * @param comp
+ * {@.ja 追å 対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for add}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t addComponent(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE, "addComponent()");
+ if (comp==null) {
+ rtcout.println(Logbuf.ERROR, "nil reference is given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ try {
+ synchronized (m_mutex){
+ ExecutionContextService ec = getECRef();
+ int id = comp.attach_context(ec);
+ m_addedComps.add(new RTObjectStateMachine(id, comp));
+ }
+ }
+ catch (Exception ex) {
+ rtcout.println(Logbuf.ERROR, "addComponent() failed.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG, "addComponent() succeeded.");
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja ã³ã³ãã¼ãã³ãããã¤ã³ãããã}
+ * {@.en Bind the component.}
+ * <p>
+ * {@.ja ã³ã³ãã¼ãã³ãããã¤ã³ãããã}
+ * {@.en Bind the component.}
+ *
+ * @param rtc
+ * {@.ja RTã³ã³ãã¼ãã³ã}
+ * {@.en RT-Component's instances}
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t bindComponent(RTObject_impl rtc) {
+ rtcout.println(Logbuf.TRACE, "bindComponent()");
+ synchronized (m_mutex){
+ if (rtc == null) {
+ rtcout.println(Logbuf.ERROR, "NULL pointer is given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ ExecutionContextService ec = getECRef();
+ int id = rtc.bindContext(ec);
+ if (id < 0 || id > RTObject_impl.ECOTHER_OFFSET) {
+ // id should be owned context id < ECOTHER_OFFSET
+ rtcout.println(Logbuf.ERROR,
+ "bindContext returns invalid id: "+id);
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG,
+ "bindContext returns id = "+id);
+
+ // rtc is owner of this EC
+ LightweightRTObject comp
+ = (LightweightRTObject)rtc.getObjRef()._duplicate();
+ // RTObjectStateMachine o(id, comp);
+ m_comps.add(new RTObjectStateMachine(id, comp));
+ rtcout.println(Logbuf.DEBUG,"bindComponent() succeeded.");
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãã}
+ * {@.en Remove the RT-Component from participant list}
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãããåé¤ããã
+ * RTã³ã³ãã¼ãã³ã㯠detach_context ãå¼ã°ãããæå®ãããRTã³ã³ãã¼
+ * ãã³ããåå è
ãªã¹ãã«ç»é²ããã¦ããªãå ´åã¯ãBAD_PARAMETER ãè¿
+ * ãããã}
+ * {@.en This operation causes a participant RTC to stop participating
+ * in the execution context.
+ * The removed RTC will receive a call to
+ * LightweightRTComponent::detach_context.
+ * BAD_PARAMETER will be returned, if the given RT-Component is not
+ * participating in the participant list.}
+ *
+ * @param comp
+ * {@.ja åé¤å¯¾è±¡RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for delete}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t removeComponent(LightweightRTObject comp) {
+ rtcout.println(Logbuf.TRACE,"removeComponent()");
+ if (comp==null) {
+ rtcout.println(Logbuf.ERROR,"nil reference is given.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ synchronized (m_mutex){
+ RTObjectStateMachine rtobj = findComponent(comp);
+
+ if (rtobj == null) {
+ rtcout.println(Logbuf.ERROR,
+ "no RTC found in this context.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ synchronized (m_removedMutex){
+ m_removedComps.add(rtobj);
+
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ }
+ public RTObjectStateMachine findComponent(LightweightRTObject comp) {
+ for (int ic=0; ic < m_comps.size() ; ++ic) {
+ if(m_comps.get(ic).isEquivalent(comp)) {
+ return m_comps.get(ic);
+ }
+ }
+ return null;
+ }
+
+ public boolean isAllCurrentState(LifeCycleState state) {
+ synchronized (m_mutex){
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ if (!m_comps.get(ic).isCurrentState(state)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ public boolean isAllNextState(LifeCycleState state){
+ synchronized (m_mutex){
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ if (!m_comps.get(ic).isNextState(state)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ public boolean isOneOfCurrentState(LifeCycleState state){
+ synchronized (m_mutex){
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ if (m_comps.get(ic).isCurrentState(state)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ public boolean isOneOfNextState(LifeCycleState state){
+ synchronized (m_mutex){
+ for (int ic=0; ic < m_comps.size(); ++ic) {
+ if (m_comps.get(ic).isNextState(state)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ public void invokeWorker(){
+ rtcout.println(Logbuf.PARANOID,"invokeWorker()");
+ // m_comps never changes its size here
+ int len = m_comps.size();
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerPreDo();
+ }
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerDo();
+ }
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerPostDo();
+ }
+ updateComponentList();
+ }
+ public void invokeWorkerPreDo(){
+ rtcout.println(Logbuf.PARANOID,"invokeWorkerPreDo()");
+ // m_comps never changes its size here
+ int len = m_comps.size();
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerPreDo();
+ }
+ }
+ public void invokeWorkerDo(){
+ rtcout.println(Logbuf.PARANOID,"invokeWorkerDo()");
+ // m_comps never changes its size here
+ int len = m_comps.size();
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerDo();
+ }
+ }
+ public void invokeWorkerPostDo(){
+ rtcout.println(Logbuf.PARANOID,"invokeWorkerPostDo()");
+ // m_comps never changes its size here
+ int len = m_comps.size();
+ for (int ic=0; ic < len; ++ic) {
+ m_comps.get(ic).workerPostDo();
+ }
+ // m_comps might be changed here
+ updateComponentList();
+ }
+
+
+
+ protected void updateComponentList() {
+ synchronized (m_mutex) {
+ synchronized (m_addedMutex) {// adding component
+ for (int ic=0; ic < m_addedComps.size(); ++ic) {
+ m_comps.add(m_addedComps.get(ic));
+ rtcout.println(Logbuf.TRACE,"Component added.");
+ }
+ m_addedComps.clear();
+ }
+ synchronized (m_removedMutex) {// removing component
+ for (int ic=0; ic < m_removedComps.size(); ++ic) {
+ RTObjectStateMachine rtobj = m_removedComps.get(ic);
+ LightweightRTObject lwrtobj = rtobj.getRTObject();
+ lwrtobj.detach_context(rtobj.getExecutionContextHandle());
+ Iterator it = m_comps.iterator();
+ while (it.hasNext()) {
+ if(rtobj == (RTObjectStateMachine)it.next()){
+ m_comps.remove(it);
+ }
+ }
+ rtobj = null;
+ rtcout.println(Logbuf.TRACE,"Component deleted.");
+ }
+ m_removedComps.clear();
+ }
+ }
+ }
+
+
+
+ /*!
+ * @if jp
+ * @brief ã³ã³ãã¼ãã³ãæ¤ç´¢ç¨ãã¡ã³ã¯ã¿
+ * @else
+ * @brief Functor to find the component
+ * @endif
+ */
+// struct find_comp
+// {
+// RTC::LightweightRTObject_var m_comp;
+// find_comp(RTC::LightweightRTObject_ptr comp)
+// : m_comp(RTC::LightweightRTObject::_duplicate(comp)) {}
+// boolean operator()(RTObjectStateMachine* comp)
+// {
+// return comp->isEquivalent(m_comp);
+// }
+// };
+
+ //------------------------------------------------------------
+ // member variables
+ /**
+ * {@.ja ãã¬ã¼ã¹ããªã¼ã }
+ * {@.en Logger stream}
+ */
+ protected Logbuf rtcout;
+
+ protected ExecutionContextService m_ref;
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡ç¶æ
}
+ * {@.en The running state of ExecutionContext}
+ * true: running, false: stopped
+ */
+ protected boolean m_running;
+
+ /**
+ * {@.ja ã³ã³ãã¼ãã³ãã®åå è
ãªã¹ã}
+ * {@.en List of the participating component}
+ */
+ protected ArrayList<RTObjectStateMachine> m_comps;
+ protected String m_mutex;
+ protected ArrayList<RTObjectStateMachine> m_addedComps;
+ protected String m_addedMutex;
+ ArrayList<RTObjectStateMachine> m_removedComps;
+ protected String m_removedMutex;
+
+};
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -1,10 +1,31 @@
package jp.go.aist.rtm.RTC.executionContext;
+import java.util.ArrayList;
+
import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.StateAction;
+import jp.go.aist.rtm.RTC.StateHolder;
+import jp.go.aist.rtm.RTC.StateMachine;
import jp.go.aist.rtm.RTC.log.Logbuf;
+import jp.go.aist.rtm.RTC.util.POAUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
import jp.go.aist.rtm.RTC.util.TimeValue;
import org.omg.CORBA.SystemException;
+
+import OpenRTM.ExtTrigExecutionContextServicePOA;
+import OpenRTM.ExtTrigExecutionContextServiceHelper;
+import OpenRTM.DataFlowComponent;
+import OpenRTM.DataFlowComponentHelper;
+import RTC.ExecutionContextService;
+import RTC.ExecutionContextServiceHelper;
+import RTC.ExecutionKind;
+import RTC.LifeCycleState;
+import RTC.LightweightRTObject;
+import RTC.ReturnCode_t;
/**
* {@.ja ã¹ãããå®è¡ãå¯è½ãª ExecutionContext ã¯ã©ã¹}
* {@.en ExecutionContext class that enables one step execution}
@@ -17,7 +38,8 @@
* Time(Tick) advances one cycle by invoking method externally.}
*/
public class ExtTrigExecutionContext
- extends PeriodicExecutionContext implements Runnable {
+extends ExtTrigExecutionContextServicePOA
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase{
/**
* {@.ja ã³ã³ã¹ãã©ã¯ã¿}
@@ -27,12 +49,57 @@
super();
rtcout = new Logbuf("Manager.ExtTrigExecutionContext");
+ m_profile.setObjRef((ExecutionContextService)this.__this());
}
/**
- * <p>ExecutionContextã®å¦çãï¼å¨æåé²ãã¾ãã</p>
+ * <p> __this() </p>
+ *
+ * @return ExecutionContextService
*/
+
+ public ExecutionContextService __this() {
+
+ if (this.m_ref == null) {
+ try {
+ this.m_ref = ExtTrigExecutionContextServiceHelper.narrow(POAUtil.getRef(this));
+
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ return this.m_ref;
+ }
+ /**
+ * <p>çµäºå¦çç¨é¢æ°</p>
+ */
+ public boolean finalizeExecutionContext() {
+ synchronized (m_worker) {
+ //m_worker.running_ = true;
+ m_worker.notifyAll();
+ }
+ m_svc = false;
+ try {
+ m_thread.join();
+ }
+ catch (InterruptedException e) {
+ System.out.println(e);
+ }
+
+ return true;
+ }
+
+ /**
+ * {@.ja ExecutionContextã®å¦çãé²ãã}
+ * {@.en Proceed with tick of ExecutionContext}
+ *
+ * <p>
+ * {@.ja ExecutionContextã®å¦çãï¼å¨æåé²ãã¾ãã}
+ * {@.en Proceed with tick of ExecutionContext for one period.}
+ *
+ */
public void tick() throws SystemException {
rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.tick()");
@@ -44,13 +111,25 @@
}
/**
+ * <p>ExecutionContextç¨ã®ã¹ã¬ãããçæãã¾ãã</p>
+ */
+ public int open() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.open()");
+
+ if(m_thread==null) {
+ m_thread = new Thread(this, "ExtTrigExecutionContext");
+ m_thread.start();
+ }
+ return 0;
+ }
+ /**
* <p>ExecutionContextã«attachããã¦ããåComponentã®å¦çãå¼ã³åºãã¾ãã
* å
¨Componentã®å¦çãå¼ã³åºããå¾ã次ã®ã¤ãã³ããçºçããã¾ã§ä¼æ¢ãã¾ãã</p>
*/
public int svc() {
rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.svc()");
-
do {
TimeValue tv = new TimeValue(0, m_usec); // (s, us)
@@ -65,8 +144,9 @@
if (m_worker._called) {
m_worker._called = false;
for (int intIdx = 0; intIdx < m_comps.size(); ++intIdx) {
- m_comps.elementAt(intIdx).invoke();
+ m_comps.get(intIdx).invoke();
}
+/*
while (!m_running) {
try {
Thread.sleep(0, (int) tv.getUsec());
@@ -79,6 +159,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+*/
}
}
} while (m_running);
@@ -93,6 +174,799 @@
this.svc();
}
+ //============================================================
+ // ExecutionContext
+ //============================================================
+ /**
+ * {@.ja ExecutionContext å®è¡ç¶æ
確èªé¢æ°}
+ * {@.en heck for ExecutionContext running state}
+ * <p>
+ * {@.ja ãã®æä½ã¯ ExecutionContext ã Runnning ç¶æ
ã®å ´åã« true ãè¿ãã
+ * Executioncontext ã Running ã®éãå½è©² Executioncontext ã«åå ã
+ * ã¦ããå
¨ã¦ã®ã¢ã¯ãã£ãRTã³ã³ãã¼ãã³ãããExecutionContext ã®å®
+ * è¡ç¨®é¡ã«å¿ãã¦å®è¡ãããã}
+ * {@.en This operation shall return true if the context is in the
+ * Running state. While the context is Running, all Active RTCs
+ * participating in the context shall be executed according to the
+ * contextâs execution kind.}
+ *
+ * @return
+ * {@.ja ç¶æ
確èªé¢æ°(åä½ä¸:trueãåæ¢ä¸:false)}
+ * {@.en Check state function (Running:trueãStopping:false)}
+ *
+ */
+ public boolean is_running() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.is_running()");
+
+ return m_running;
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡ãéå§}
+ * {@.en Start the ExecutionContext}
+ * <p>
+ * {@.ja ExecutionContext ã®å®è¡ç¶æ
ã Runnning ã¨ããããã®ãªã¯ã¨ã¹ãã
+ * çºè¡ãããExecutionContext ã®ç¶æ
ãé·ç§»ããã¨
+ * ComponentAction::on_startup ãå¼ã³åºããããåå ãã¦ããRTã³ã³ãã¼
+ * ãã³ãããåæåãããã¾ã§ ExecutionContext ãéå§ãããã¨ã¯ã§ã
+ * ãªããExecutionContext ã¯è¤æ°åéå§/åæ¢ãç¹°ãè¿ããã¨ãã§ããã}
+ * {@.en Request that the context enter the Running state. Once the
+ * state transition occurs, the ComponentAction::on_startup
+ * operation will be invoked. An execution context may not be
+ * started until the RT-Components that participate in it have
+ * been initialized. An execution context may be started and
+ * stopped multiple times.}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t start() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.start()");
+
+ if( m_running ) return ReturnCode_t.PRECONDITION_NOT_MET;
+
+ // invoke ComponentAction::on_startup for each comps.
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ m_comps.get(intIdx).invoke_on_startup();
+ }
+ // change EC thread state
+ m_running = true;
+ synchronized (m_worker) {
+ //m_worker.running_ = true;
+ m_worker.notifyAll();
+ }
+
+ this.open();
+
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡ãåæ¢}
+ * {@.en Stop the ExecutionContext}
+ * <p>
+ * {@.ja ExecutionContext ã®ç¶æ
ã Stopped ã¨ããããã®ãªã¯ã¨ã¹ããçºè¡ã
+ * ããé·ç§»ãçºçããå ´åã¯ãComponentAction::on_shutdown ãå¼ã³åº
+ * ããããåå ãã¦ããRTã³ã³ãã¼ãã³ããçµäºããåã«
+ * ExecutionContext ãåæ¢ããå¿
è¦ããããExecutionContext ã¯è¤æ°å
+ * éå§/åæ¢ãç¹°ãè¿ããã¨ãã§ããã}
+ * {@.en Request that the context enter the Stopped state. Once the
+ * transition occurs, the ComponentAction::on_shutdown operation
+ * will be invoked. An execution context must be stopped before
+ * the RT components that participate in it are finalized. An
+ * execution context may be started and stopped multiple times.}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t stop(){
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.stop()");
+
+ if( !m_running ) return ReturnCode_t.PRECONDITION_NOT_MET;
+
+ // change EC thread state
+ m_running = false;
+ synchronized (m_worker) {
+ //m_worker.running_ = false;
+ }
+
+ // invoke on_shutdown for each comps.
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ m_comps.get(intIdx).invoke_on_shutdown();
+ }
+
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãåå¾ãã}
+ * {@.en Get execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãåå¾ã
+ * ãã}
+ * {@.en This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.}
+ *
+ * @return
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ */
+ public double get_rate() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_rate()");
+
+ return m_profile.getRate();
+ }
+ /**
+ * <p>ExecutionContextã®å®è¡å¨æ(Hz)ãè¨å®ãã¾ãã</p>
+ *
+ * @param rate å®è¡å¨æ(Hz)
+ */
+ public ReturnCode_t set_rate(double rate) {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.set_rate("+rate+")");
+
+ if( rate<=0.0 ) return ReturnCode_t.BAD_PARAMETER;
+
+ m_profile.setRate(rate);
+ this.m_usec = (long)(1000000/rate);
+ if( m_usec == 0 ) {
+ m_nowait = true;
+ }
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ m_comps.get(intIdx).invoke_on_rate_changed();
+ }
+ rtcout.println(Logbuf.DEBUG, "Actual period: "
+ + m_profile.getPeriod().sec()
+ + " [sec], "
+ + m_profile.getPeriod().usec()
+ + " [usec]");
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * <p>ã³ã³ãã¼ãã³ããã¢ã¯ãã£ãåãã¾ãã</p>
+ *
+ * @param comp ã¢ã¯ãã£ãå対象ã³ã³ãã¼ãã³ã
+ *
+ * @return å®è¡çµæ
+ */
+ public ReturnCode_t activate_component(LightweightRTObject comp) {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.activate_component()");
+
+ // ã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«ç¡ããã° BAD_PARAMETER ãè¿ã
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+ if (find.eqaulof(m_comps.get(intIdx)) ) {
+ // the given component must be in Alive state.
+ if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.INACTIVE_STATE))) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.ACTIVE_STATE);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ /**
+ * <p>ã³ã³ãã¼ãã³ããéã¢ã¯ãã£ãåãã¾ãã</p>
+ *
+ * @param comp éã¢ã¯ãã£ãå対象ã³ã³ãã¼ãã³ã
+ *
+ * @return å®è¡çµæ
+ */
+ public ReturnCode_t deactivate_component(LightweightRTObject comp) {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.deactivate_component()");
+
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+ if (find.eqaulof(m_comps.get(intIdx)) ) {
+ // the given component must be in Alive state.
+ if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.ACTIVE_STATE))) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ /**
+ * <p>ã³ã³ãã¼ãã³ãããªã»ãããã¾ãã</p>
+ *
+ * @param comp ãªã»ãã対象ã³ã³ãã¼ãã³ã
+ *
+ * @return å®è¡çµæ
+ */
+ public ReturnCode_t reset_component(LightweightRTObject comp){
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.reset_component()");
+
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+ if (find.eqaulof(m_comps.get(intIdx)) ) {
+ // the given component must be in Alive state.
+ if(!(m_comps.get(intIdx)._sm.m_sm.isIn(LifeCycleState.ERROR_STATE))) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ m_comps.get(intIdx)._sm.m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ /**
+ * <p>ã³ã³ãã¼ãã³ãã®ç¶æ
ãåå¾ãã¾ãã</p>
+ *
+ * @param comp ç¶æ
åå¾å¯¾è±¡ã³ã³ãã¼ãã³ã
+ *
+ * @return ã³ã³ãã¼ãã³ãç¶æ
+ */
+ public LifeCycleState get_component_state(LightweightRTObject comp) {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_component_state()");
+
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ find_comp find = new find_comp((LightweightRTObject)comp._duplicate());
+ if (find.eqaulof(m_comps.get(intIdx)) ) {
+ return m_comps.get(intIdx)._sm.m_sm.getState();
+ }
+ }
+ return LifeCycleState.CREATED_STATE;
+ }
+
+ /**
+ * <p>ExecutionKindãåå¾ãã¾ãã</p>
+ *
+ * @return ExecutionKind
+ */
+ public ExecutionKind get_kind() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_kind() ="
+ + m_profile.getKindString());
+
+ return m_profile.getKind();
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ãã追å ãã}
+ * {@.en Add an RT-component}
+ *
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãã«è¿½å ããã追å ãããRTã³
+ * ã³ãã¼ãã³ã㯠attach_context ãå¼ã°ããInactive ç¶æ
ã«é·ç§»ããã
+ * æå®ãããRTã³ã³ãã¼ãã³ããnullã®å ´åã¯ãBAD_PARAMETER ãè¿ãã
+ * ããæå®ãããRTã³ã³ãã¼ãã³ãã DataFlowComponent 以å¤ã®å ´åã¯ã
+ * BAD_PARAMETER ãè¿ãããã}
+ * {@.en The operation causes the given RTC to begin participating in
+ * the execution context. The newly added RTC will receive a call
+ * to LightweightRTComponent::attach_context and then enter the
+ * Inactive state. BAD_PARAMETER will be invoked, if the given
+ * RT-Component is null or if the given RT-Component is other than
+ * DataFlowComponent.}
+ *
+ * @param comp
+ * {@.ja 追å 対象RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for add}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ *
+ */
+ public ReturnCode_t add_component(LightweightRTObject comp) {
+
+ rtcout.println(Logbuf.TRACE,
+ "ExtTrigExecutionContext.add_component()");
+
+ if( comp==null ) return ReturnCode_t.BAD_PARAMETER;
+ //
+ try {
+ DataFlowComponent dfp = DataFlowComponentHelper.narrow(comp);
+ if( dfp==null ) {
+ // Because the ExecutionKind of this context is PERIODIC,
+ // the RTC must be a data flow component.
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ //
+ int id = dfp.attach_context(m_ref);
+ //
+ m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
+ (DataFlowComponent)dfp._duplicate(), id));
+ m_profile.addComponent((LightweightRTObject)comp._duplicate());
+ return ReturnCode_t.RTC_OK;
+ } catch(Exception ex) {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+ }
+
+ /**
+ * {@.ja ã³ã³ãã¼ãã³ãããã¤ã³ãããã}
+ * {@.en Bind the component.}
+ *
+ * <p>
+ * {@.ja ã³ã³ãã¼ãã³ãããã¤ã³ãããã}
+ * {@.en Bind the component.}
+ *
+ * @param rtc
+ * {@.ja RTã³ã³ãã¼ãã³ã}
+ * {@.en RT-Component's instances}
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t bindComponent(RTObject_impl rtc) {
+
+ rtcout.println(Logbuf.TRACE,
+ "ExtTrigExecutionContext.bindComponent()");
+
+ if (rtc == null) return ReturnCode_t.BAD_PARAMETER;
+
+ LightweightRTObject comp = rtc.getObjRef();
+ DataFlowComponent dfp;
+ dfp = DataFlowComponentHelper.narrow(comp);
+
+ int id = rtc.bindContext(m_ref);
+ if (id < 0 || id > RTObject_impl.ECOTHER_OFFSET) {
+ rtcout.println(Logbuf.ERROR, "bindContext returns invalid id: "+id);
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG, "bindComponent() returns id = "+id);
+ m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
+ (DataFlowComponent)dfp._duplicate(),
+ id));
+ m_profile.setOwner((LightweightRTObject)dfp._duplicate());
+
+
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja RTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãã}
+ * {@.en Remove the RT-Component from participant list}
+ *
+ * <p>
+ * {@.ja æå®ããRTã³ã³ãã¼ãã³ããåå è
ãªã¹ãããåé¤ãããåé¤ããã
+ * RTã³ã³ãã¼ãã³ã㯠detach_context ãå¼ã°ãããæå®ãããRTã³ã³ãã¼
+ * ãã³ããåå è
ãªã¹ãã«ç»é²ããã¦ããªãå ´åã¯ãBAD_PARAMETER ãè¿
+ * ãããã}
+ * {@.en This operation causes a participant RTC to stop participating in
+ * the execution context.
+ * The removed RTC will receive a call to
+ * LightweightRTComponent::detach_context.
+ * BAD_PARAMETER will be returned, if the given RT-Component is not
+ * participating in the participant list.}
+ *
+ * @param comp
+ * {@.ja åé¤å¯¾è±¡RTã³ã³ãã¼ãã³ã}
+ * {@.en The target RT-Component for delete}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã}
+ * {@.en The return code of ReturnCode_t type}
+ *
+ */
+ public ReturnCode_t remove_component(LightweightRTObject comp) {
+
+ rtcout.println(Logbuf.TRACE,
+ "ExtTrigExecutionContext.remove_component()");
+
+ for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
+ find_comp find
+ = new find_comp((LightweightRTObject)comp._duplicate());
+ if (find.eqaulof(m_comps.get(intIdx)) ) {
+ m_comps.get(intIdx)._ref.detach_context(
+ m_comps.get(intIdx)._sm.ec_id);
+ m_comps.get(intIdx)._ref = null;
+ m_comps.remove(m_comps.get(intIdx));
+ rtcout.println(Logbuf.TRACE,
+ "remove_component(): an RTC removed from this context.");
+ m_profile.removeComponent(comp);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ rtcout.println(Logbuf.TRACE, "remove_component(): no RTC found in this context.");
+ return ReturnCode_t.BAD_PARAMETER;
+ }
+
+ /**
+ * <p>ExecutionContextProfile ãåå¾ãã¾ãã</p>
+ *
+ * @return ExecutionContextProfile
+ */
+ public RTC.ExecutionContextProfile get_profile() {
+
+ rtcout.println(Logbuf.TRACE, "ExtTrigExecutionContext.get_profile()");
+ return m_profile.getProfile();
+ }
+
+ /**
+ * <p>DataFlowComponentã®Actionå®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ protected abstract class DFPBase {
+ /**
+ * <p>ã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
+ *
+ * @param id ExecutionContextã®ID
+ */
+ public DFPBase(int id) {
+ ec_id = id;
+ m_sm = new StateMachine(3);
+ m_sm.setListener(this);
+ StateHolder st = new StateHolder();
+ m_sm.setEntryAction(LifeCycleState.ACTIVE_STATE, new onActivated());
+ m_sm.setDoAction(LifeCycleState.ACTIVE_STATE, new onExecute());
+ m_sm.setPostDoAction(LifeCycleState.ACTIVE_STATE, new onStateUpdate());
+ m_sm.setExitAction(LifeCycleState.ACTIVE_STATE, new onDeactivated());
+ m_sm.setEntryAction(LifeCycleState.ERROR_STATE, new onAborting());
+ m_sm.setDoAction(LifeCycleState.ERROR_STATE, new onError());
+ m_sm.setExitAction(LifeCycleState.ERROR_STATE, new onReset());
+
+ st.prev = LifeCycleState.INACTIVE_STATE;
+ st.curr = LifeCycleState.INACTIVE_STATE;
+ st.next = LifeCycleState.INACTIVE_STATE;
+ m_sm.setStartState(st);
+ m_sm.goTo(LifeCycleState.INACTIVE_STATE);
+ }
+ /**
+ * <p>onActivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onActivated implements StateAction {
+ public void doAction(StateHolder state) {
+ on_activated(state);
+ }
+ }
+ /**
+ * <p>onExecuteã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onExecute implements StateAction {
+ public void doAction(StateHolder state) {
+ on_execute(state);
+ }
+ }
+ /**
+ * <p>onStateUpdateã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onStateUpdate implements StateAction {
+ public void doAction(StateHolder state) {
+ on_state_update(state);
+ }
+ }
+ /**
+ * <p>onDeactivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onDeactivated implements StateAction {
+ public void doAction(StateHolder state) {
+ on_deactivated(state);
+ }
+ }
+ /**
+ * <p>onAbortingã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onAborting implements StateAction {
+ public void doAction(StateHolder state) {
+ on_aborting(state);
+ }
+ }
+ /**
+ * <p>onErrorã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onError implements StateAction {
+ public void doAction(StateHolder state) {
+ on_error(state);
+ }
+ }
+ /**
+ * <p>onResetã¢ã¯ã·ã§ã³å®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ private class onReset implements StateAction {
+ public void doAction(StateHolder state) {
+ on_reset(state);
+ }
+ }
+
+ /**
+ * <p>ExecutionContextã®startæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_startup();
+ /**
+ * <p>ExecutionContextã®stopæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_shutdown();
+
+ /**
+ * <p>ã³ã³ãã¼ãã³ãã®activateæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_activated(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ãã®deactivateæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_deactivated(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ãã®abortæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_aborting(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ããerrorç¶æ
ã®æã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_error(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ãresetæã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_reset(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ãå®è¡æã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_execute(final StateHolder st);
+ /**
+ * <p>ã³ã³ãã¼ãã³ãã®å®è¡æã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_state_update(final StateHolder st);
+
+ /**
+ * <p>ExecutionContextã®å®è¡å¨æå¤æ´æã«å¼ã°ããæ½è±¡ã¡ã½ããã§ãã</p>
+ */
+ public abstract void on_rate_changed();
+ /**
+ * <p>ExecutionContextã®ç¶æ
é·ç§»ç¨ã¯ã¼ã«ã¼ã§ãã</p>
+ */
+ public void worker() {
+ m_sm.worker();
+ }
+ public void worker_pre() {
+ m_sm.worker_pre();
+ }
+ public void worker_do() {
+ m_sm.worker_do();
+ }
+ public void worker_post() {
+ m_sm.worker_post();
+ }
+
+ /**
+ * <p>ç¾å¨ã®ç¶æ
ãåå¾ãã¾ãã</p>
+ *
+ * @return ç¾å¨ã®ç¶æ
+ */
+ public LifeCycleState get_state(){
+ return m_sm.getState();
+ }
+
+ /**
+ * <p>ExecutionContextã®ID</p>
+ */
+ public int ec_id;
+ /**
+ * <p>ExecutionContextã®StateMachine</p>
+ */
+ public StateMachine<LifeCycleState, DFPBase> m_sm;
+
+ }
+
+ /**
+ * <p>DataFlowComponentã®Actionå®ç¾©ç¨æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+ protected class DFP extends DFPBase {
+ /**
+ * <p>ã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
+ *
+ * @param obj 対象ã³ã³ãã¼ãã³ã
+ * @param id ExecutionContextã®ID
+ */
+ public DFP(DataFlowComponent obj, int id) {
+ super(id);
+ m_obj = obj;
+ }
+ /**
+ * <p>onStartupã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_startup() {
+ m_obj.on_startup(ec_id);
+ }
+ /**
+ * <p>onShutdownã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_shutdown() {
+ m_obj.on_shutdown(ec_id);
+ }
+ /**
+ * <p>onActivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_activated(final StateHolder st) {
+ if( m_obj.on_activated(ec_id) != ReturnCode_t.RTC_OK ) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ * <p>onDeactivatedã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_deactivated(final StateHolder st) {
+ if( m_obj.on_deactivated(ec_id) != ReturnCode_t.RTC_OK ) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ * <p>onAbortingã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_aborting(final StateHolder st) {
+ m_obj.on_aborting(ec_id);
+ }
+ /**
+ * <p>onErrorã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_error(final StateHolder st) {
+ m_obj.on_error(ec_id);
+ }
+ /**
+ * <p>onResetã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_reset(final StateHolder st) {
+ if( m_obj.on_reset(ec_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ * <p>onExecuteã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_execute(final StateHolder st) {
+ if( m_obj.on_execute(ec_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ * <p>onStateUpdateã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_state_update(final StateHolder st) {
+ if( m_obj.on_state_update(ec_id) != ReturnCode_t.RTC_OK) {
+ m_sm.goTo(LifeCycleState.ERROR_STATE);
+ return;
+ }
+ return;
+ }
+ /**
+ * <p>onRateChangedã¢ã¯ã·ã§ã³å®ç¾©ç¨ã¡ã½ããã§ãã</p>
+ */
+ public void on_rate_changed() {
+ m_obj.on_rate_changed(ec_id);
+ }
+ private DataFlowComponent m_obj;
+ }
+
+ /**
+ * <p>ExecutionContextã«attachãããã³ã³ãã¼ãã³ãã®ã¡ã½ããå¼åºç¨ã¯ã©ã¹ã§ãã</p>
+ */
+ protected class Comp {
+ /**
+ * <p>ã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
+ *
+ * @param ref 対象ã³ã³ãã¼ãã³ã
+ * @param dfp ExecutionContextã®å¯¾è±¡StateMachine
+ * @param id ExecutionContextã®ID
+ */
+ public Comp(LightweightRTObject ref, DataFlowComponent dfp, int id) {
+ this._ref = ref;
+ this._sm = new DFP(dfp, id);
+ }
+ /**
+ * <p>ã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
+ *
+ * @param comp 対象ã³ã³ãã¼ãã³ã
+ */
+ public Comp(final Comp comp) {
+ this._ref = comp._ref;
+ this._sm = new DFP(comp._sm.m_obj, comp._sm.ec_id);
+ }
+ /**
+ * <p>ã³ã³ãã¼ãã³ããã³ãã¼ãã¾ãã</p>
+ *
+ * @param comp 対象ã³ã³ãã¼ãã³ã
+ */
+ public Comp substitute(final Comp comp) {
+ this._ref = comp._ref;
+ this._sm.m_obj = comp._sm.m_obj;
+ this._sm.ec_id = comp._sm.ec_id;
+ return this;
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke(){
+ this._sm.worker();
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_pre(){
+ this._sm.worker_pre();
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_do(){
+ this._sm.worker_do();
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_post(){
+ this._sm.worker_post();
+ }
+ /**
+ * <p>StartUpæã«å¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_on_startup(){
+ this._sm.on_startup();
+ }
+ /**
+ * <p>ShutDownæã«å¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_on_shutdown(){
+ this._sm.on_shutdown();
+ }
+ /**
+ * <p>RateChangedæã«å¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_on_rate_changed(){
+ this._sm.on_rate_changed();
+ }
+ /**
+ * <p>StateMachine管ç対象ã³ã³ãã¼ãã³ãã§ãã</p>
+ */
+ public LightweightRTObject _ref;
+ /**
+ * <p>対象ã³ã³ãã¼ãã³ãã®StateMachineã§ãã</p>
+ */
+ public DFP _sm;
+ }
+ /**
+ * <p>管ç対象ã³ã³ãã¼ãã³ãæ¤ç´¢ç¨ãã«ãã¼ã¯ã©ã¹ã§ãã</p>
+ */
+ protected class find_comp {
+ private LightweightRTObject m_comp;
+ public find_comp(LightweightRTObject comp) {
+ m_comp = comp;
+ }
+ public boolean eqaulof(Comp comp) {
+ return comp._ref._is_equivalent(m_comp);
+ }
+ };
+
+ /**
+ * <p>ExecutionContextã«atttachããã¦ããã³ã³ãã¼ãã³ãã®ãªã¹ãã§ãã</p>
+ */
+ protected ArrayList<Comp> m_comps = new ArrayList<Comp>();
+ /**
+ * <p>ExecutionContextã®å®è¡ç¶æ
ã§ãã</p>
+ */
+ protected boolean m_running;
+ /**
+ * <p>ExecutionContext ã®ã¹ã¬ããå®è¡ãã©ã°ã§ãã</p>
+ */
+ private boolean m_svc;
+
private class Worker {
public Worker() {
@@ -103,15 +977,60 @@
}
private Worker m_worker = new Worker();
+ /**
+ * <p>ExecutionContextProfileã§ãã</p>
+ */
+ protected ExecutionContextProfile m_profile = new ExecutionContextProfile();
+ /**
+ * <p>ExecutionContextã®åä½å¨æã§ãã</p>
+ */
+ protected long m_usec;
+ /**
+ * <p>ExecutionContextServiceã¨ãã¦ã®CORBAãªãã¸ã§ã¯ãåç
§ã§ãã</p>
+ */
+ protected ExecutionContextService m_ref;
+ protected boolean m_nowait;
+ protected Thread m_thread = null;
+
/**
+ * {@.ja OpenHRPExecutionContext ãçæãã}
+ * {@.en Creats OpenHRPExecutionContext}
+ *
+ * @return
+ * {@.ja çæãããExtTrigExecutionContext}
+ * {@.en Object Created instances}
+ *
+ *
+ */
+ public ExecutionContextBase creator_() {
+ return new ExtTrigExecutionContext();
+ }
+ /**
+ * {@.ja Object ãç ´æ£ãã}
+ * {@.en Destructs Object}
+ *
+ * @param obj
+ * {@.ja ç ´æ£ããã¤ã³ã¿ã¹ã¿ã³ã¹}
+ * {@.en The target instances for destruction}
+ *
+ */
+ public void destructor_(Object obj) {
+ obj = null;
+ }
+ /**
* <p>ãã®ExecutionContextãçæããFactoryã¯ã©ã¹ã
* ExecutionContextç¨ObjectManagerã«ç»é²ãã¾ãã</p>
*
* @param manager Managerãªãã¸ã§ã¯ã
*/
public static void ExtTrigExecutionContextInit(Manager manager) {
- manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.ExtTrigExecutionContext");
+
+ ExecutionContextFactory<ExecutionContextBase,String> factory
+ = ExecutionContextFactory.instance();
+ factory.addFactory("jp.go.aist.rtm.RTC.executionContext.ExtTrigExecutionContext",
+ new ExtTrigExecutionContext(),
+ new ExtTrigExecutionContext());
}
/**
@@ -136,4 +1055,113 @@
* <p>Loggingç¨ãã©ã¼ããããªãã¸ã§ã¯ã</p>
*/
protected Logbuf rtcout;
+ /**
+ * {@.ja ExecutionContextã¯ã©ã¹ã®åæåé¢æ°}
+ * {@.en Initialization function of ExecutionContext class}
+ */
+ public void init(Properties props) {
+ }
+
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
+ */
+ public void setObjRef(final ExecutionContextService ref) {
+ m_profile.setObjRef(ref);
+ }
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
+ */
+ public ExecutionContextService getObjRef() {
+ return m_profile.getObjRef();
+ }
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãè¨å®ãã}
+ * {@.en Set execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãè¨å®ã
+ * ããå®è¡å¨æã®å¤æ´ã¯ãDataFlowComponentAction ã®
+ * on_rate_changed ã«ãã£ã¦åRTã³ã³ãã¼ãã³ãã«ä¼éãããã}
+ * {@.en This operation shall set the rate (in hertz) at which this
+ * contextâs Active participating RTCs are being called. If the
+ * execution kind of the context is PERIODIC, a rate change shall
+ * result in the invocation of on_rate_changed on any RTCs
+ * realizing DataFlowComponentAction that are registered with any
+ * RTCs participating in the context.}
+ *
+ * @param rate
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã
+ * RTC_OK: æ£å¸¸çµäº
+ * BAD_PARAMETER: è¨å®å¤ãè² ã®å¤}
+ * {@.en The return code of ReturnCode_t type
+ * RTC_OK: Succeed
+ * BAD_PARAMETER: Invalid value. The value might be negative.}
+ *
+ */
+ public ReturnCode_t setRate(double rate) {
+ return m_profile.setRate(rate);
+ }
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãåå¾ãã}
+ * {@.en Get execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãåå¾ã
+ * ãã}
+ * {@.en This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.}
+ *
+ * @return
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ */
+ public double getRate() {
+ return m_profile.getRate();
+ }
+ /**
+ * {@.ja ExecutionKind ãæåååãã}
+ * {@.en Converting ExecutionKind enum to string}
+ * <p>
+ * {@.ja RTC::ExecutionKind ã§å®ç¾©ããã¦ãã PERIODIC, EVENT_DRIVEN,
+ * OTHER ãæåååããã}
+ * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+ * OTHER) defined in RTC::ExecutionKind to string.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ * @return
+ * {@.ja æåååãããExecutionKind}
+ * {@.en String of ExecutionKind}
+ *
+ */
+ public final String getKindString(ExecutionKind kind) {
+ return m_profile.getKindString(kind);
+ }
+
}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java (from rev 661, trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/IExecutionContextBase.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -0,0 +1,46 @@
+package jp.go.aist.rtm.RTC.executionContext;
+
+import org.omg.CORBA.SystemException;
+
+import RTC.ExecutionContextService;
+import OpenRTM.ExtTrigExecutionContextServicePOA;
+
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+import RTC.ExecutionKind;
+import RTC.ReturnCode_t;
+
+/**
+ * <p>Periodic Sampled Data Processing(å¨æå®è¡ç¨)ExecutionContextã®ãã¼ã¹ã¨ãªã
+ * æ½è±¡ã¯ã©ã¹ã§ãã</p>
+ */
+//public abstract class ExecutionContextBase
+// implements ECNewDeleteFunc {
+public interface IExecutionContextBase extends ECNewDeleteFunc {
+
+ /**
+ * {@.ja ExecutionContextã¯ã©ã¹ã®åæåé¢æ°}
+ * {@.en Initialization function of ExecutionContext class}
+ */
+ public void init(Properties props);
+
+ /**
+ * <p> bindComponent </p>
+ *
+ * @param rtc RTObject
+ * @return ReturnCode_t
+ *
+ */
+ public ReturnCode_t bindComponent(RTObject_impl rtc);
+
+ public boolean finalizeExecutionContext();
+/*
+ public ExecutionContextProfile m_profile
+ = new jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile();
+*/
+/*
+ protected ExecutionContextProfile m_profile
+ = new ExecutionContextProfile();
+*/
+
+}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -1,6 +1,8 @@
package jp.go.aist.rtm.RTC.executionContext;
import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
import org.omg.CORBA.SystemException;
@@ -9,8 +11,9 @@
*
*/
public class OpenHRPExecutionContext
- extends PeriodicExecutionContext implements Runnable{
-
+// extends PeriodicExecutionContext implements Runnable{
+extends PeriodicExecutionContext
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase{
/**
* <p> Constructor </p>
*/
@@ -72,12 +75,42 @@
private Worker m_worker = new Worker();
/**
+ * {@.ja OpenHRPExecutionContext ãçæãã}
+ * {@.en Creats OpenHRPExecutionContext}
+ *
+ * @return
+ * {@.ja çæãããOpenHRPExecutionContext}
+ * {@.en Object Created instances}
+ *
+ *
+ */
+ public OpenHRPExecutionContext creator_() {
+ return new OpenHRPExecutionContext();
+ }
+ /**
+ * {@.ja Object ãç ´æ£ãã}
+ * {@.en Destructs Object}
+ *
+ * @param obj
+ * {@.ja ç ´æ£ããã¤ã³ã¿ã¹ã¿ã³ã¹}
+ * {@.en The target instances for destruction}
+ *
+ */
+ public void destructor_(Object obj) {
+ obj = null;
+ }
+ /**
* <p> OpenHRPExecutionContextInit </p>
*
* @param manager Manager
*/
public static void OpenHRPExecutionContextInit(Manager manager) {
- manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext");
+// manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext");
+ ExecutionContextFactory<ExecutionContextBase,String> factory
+ = ExecutionContextFactory.instance();
+ factory.addFactory("jp.go.aist.rtm.RTC.executionContext.OpenHRPExecutionContext",
+ new OpenHRPExecutionContext(),
+ new OpenHRPExecutionContext());
}
/**
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java 2015-10-28 01:21:46 UTC (rev 731)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java 2015-10-28 01:44:04 UTC (rev 732)
@@ -3,6 +3,8 @@
import java.util.Vector;
import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ObjectCreator;
+import jp.go.aist.rtm.RTC.ObjectDestructor;
import jp.go.aist.rtm.RTC.RTObject_impl;
import jp.go.aist.rtm.RTC.StateAction;
import jp.go.aist.rtm.RTC.StateHolder;
@@ -11,13 +13,16 @@
import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
import jp.go.aist.rtm.RTC.util.NVUtil;
import jp.go.aist.rtm.RTC.util.POAUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.TimeValue;
import jp.go.aist.rtm.RTC.util.equalFunctor;
+//import RTC.ExecutionContextProfile;
import OpenRTM.DataFlowComponent;
import OpenRTM.DataFlowComponentHelper;
-import RTC.ExecutionContextProfile;
import RTC.ExecutionContextProfileHolder;
import RTC.ExecutionContextService;
import RTC.ExecutionContextServiceHelper;
+import RTC.ExecutionContextServicePOA;
import RTC.ExecutionKind;
import RTC.LifeCycleState;
import RTC.LightweightRTObject;
@@ -28,8 +33,12 @@
* <p>Periodic Sampled Data Processing(å¨æå®è¡ç¨)ExecutionContextã¯ã©ã¹ã§ãã</p>
*/
-public class PeriodicExecutionContext extends ExecutionContextBase implements Runnable {
+//public class PeriodicExecutionContext extends ExtTrigExecutionContextServicePOA implements Runnable, ExecutionContextBase {
+public class PeriodicExecutionContext
+extends ExecutionContextServicePOA
+implements Runnable, ObjectCreator<ExecutionContextBase>, ObjectDestructor, ExecutionContextBase {
+
/**
* {@.ja ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿}
* {@.en Default Constructor}
@@ -55,14 +64,21 @@
m_usec = (long)(1000000/rate);
- m_ref = (ExecutionContextService)this.__this();
+ //m_ref = (ExecutionContextService)this.__this();
+ m_profile.setObjRef((ExecutionContextService)this.__this());
+ m_profile.setPeriod(new TimeValue(1.0 / rate));
+ m_profile.setKind(ExecutionKind.PERIODIC);
+ m_profile.setRate(1.0 / jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile.DEEFAULT_PERIOD);
+
+/*
m_profile.kind = ExecutionKind.PERIODIC;
m_profile.rate = 0.0;
m_profile.owner = (RTC.RTObject)null;
m_profile.participants = new RTC.RTObject[0];
m_profile.properties = new _SDOPackage.NameValue[0];
+*/
}
/**
@@ -107,19 +123,29 @@
m_svc = true;
m_nowait = true;
- if( rate==0 ) rate = (1.0/0.000001);//1000000Hz
-
+ if( rate==0 ) {
+ rate = (1.0/0.000001);//1000000Hz
+ }
m_usec = (long)(1000000/rate);
- if( m_usec==0 ) m_nowait = true;
+ if( m_usec==0 ) {
+ m_nowait = true;
+ }
- m_ref = (ExecutionContextService)this.__this();
+ //m_ref = (ExecutionContextService)this.__this();
+ m_profile.setObjRef((ExecutionContextService)this.__this());
+ m_profile.setPeriod(new TimeValue(1.0 / rate));
+ m_profile.setKind(ExecutionKind.PERIODIC);
+ m_profile.setRate(1.0 / jp.go.aist.rtm.RTC.executionContext.ExecutionContextProfile.DEEFAULT_PERIOD);
+ m_profile.setOwner((LightweightRTObject)owner._duplicate());
+/*
m_profile.kind = ExecutionKind.PERIODIC;
m_profile.rate = rate;
m_profile.owner = owner;
m_profile.participants = new RTC.RTObject[0];
m_profile.properties = new _SDOPackage.NameValue[0];
+*/
}
/**
@@ -177,12 +203,14 @@
*
* @return ExecutionContextService
*/
+/*
public ExecutionContextService getObjRef() {
rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.getObjRef()");
return m_ref;
}
+*/
/**
* <p>æ¬ãªãã¸ã§ã¯ãã®ExecutionContextServiceã¨ãã¦ã®CORBAãªãã¸ã§ã¯ãåç
§ãè¨å®ãã¾ãã</p>
*
@@ -228,7 +256,9 @@
}
if (m_worker.running_) {
for (int intIdx=0; intIdx < m_comps.size(); ++intIdx) {
- m_comps.elementAt(intIdx).invoke();
+ m_comps.get(intIdx).invoke_work_pre();
+ m_comps.get(intIdx).invoke_work_do();
+ m_comps.get(intIdx).invoke_work_post();
}
}
}
@@ -344,9 +374,12 @@
rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_rate()");
+ return m_profile.getRate();
+/*
synchronized (m_profile) {
return m_profile.rate;
}
+*/
}
/**
@@ -360,14 +393,24 @@
if( rate<=0.0 ) return ReturnCode_t.BAD_PARAMETER;
+ m_profile.setRate(rate);
+/*
synchronized (m_profile) {
m_profile.rate = rate;
}
+*/
this.m_usec = (long)(1000000/rate);
- if( m_usec == 0 ) m_nowait = true;
+ if( m_usec == 0 ) {
+ m_nowait = true;
+ }
for(int intIdx=0;intIdx<m_comps.size();intIdx++ ) {
m_comps.elementAt(intIdx).invoke_on_rate_changed();
}
+ rtcout.println(Logbuf.DEBUG, "Actual period: "
+ + m_profile.getPeriod().sec()
+ + " [sec], "
+ + m_profile.getPeriod().usec()
+ + " [usec]");
return ReturnCode_t.RTC_OK;
}
@@ -474,9 +517,11 @@
*/
public ExecutionKind get_kind() {
- rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_kind()");
+ rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_kind() ="
+ + m_profile.getKindString());
- return m_profile.kind;
+ return m_profile.getKind();
+ //return m_profile.kind;
}
/**
@@ -525,11 +570,14 @@
//
m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
(DataFlowComponent)dfp._duplicate(), id));
+ m_profile.addComponent((LightweightRTObject)comp._duplicate());
+/*
RTC.RTCListHolder holder
= new RTC.RTCListHolder(m_profile.participants);
CORBA_SeqUtil.push_back(holder,
RTC.RTObjectHelper.narrow(comp));
m_profile.participants = holder.value;
+*/
return ReturnCode_t.RTC_OK;
} catch(Exception ex) {
return ReturnCode_t.BAD_PARAMETER;
@@ -572,7 +620,8 @@
m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
(DataFlowComponent)dfp._duplicate(),
id));
- m_profile.owner = (DataFlowComponent)dfp._duplicate();
+ m_profile.setOwner((LightweightRTObject)dfp._duplicate());
+ //m_profile.owner = (DataFlowComponent)dfp._duplicate();
return ReturnCode_t.RTC_OK;
@@ -616,7 +665,10 @@
m_comps.elementAt(intIdx)._sm.ec_id);
m_comps.elementAt(intIdx)._ref = null;
m_comps.remove(m_comps.elementAt(intIdx));
- rtcout.println(Logbuf.TRACE, "remove_component(): an RTC removed from this context.");
+ rtcout.println(Logbuf.TRACE,
+ "remove_component(): an RTC removed from this context.");
+ m_profile.removeComponent(comp);
+/*
RTC.RTObject rtcomp = RTC.RTObjectHelper.narrow(comp);
if(rtcomp == null){
rtcout.println(Logbuf.ERROR,"Invalid object reference.");
@@ -636,6 +688,7 @@
CORBA_SeqUtil.erase(holder, (int)index);
m_profile.participants = holder.value;
}
+*/
return ReturnCode_t.RTC_OK;
}
}
@@ -651,15 +704,17 @@
*
* @return ExecutionContextProfile
*/
- public ExecutionContextProfile get_profile() {
+ public RTC.ExecutionContextProfile get_profile() {
rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_profile()");
-
+ return m_profile.getProfile();
+/*
ExecutionContextProfileHolder p;
synchronized (m_profile) {
p = new ExecutionContextProfileHolder(m_profile);
}
return p.value;
+*/
}
/**
@@ -795,6 +850,15 @@
public void worker() {
m_sm.worker();
}
+ public void worker_pre() {
+ m_sm.worker_pre();
+ }
+ public void worker_do() {
+ m_sm.worker_do();
+ }
+ public void worker_post() {
+ m_sm.worker_post();
+ }
/**
* <p>ç¾å¨ã®ç¶æ
ãåå¾ãã¾ãã</p>
@@ -955,6 +1019,24 @@
this._sm.worker();
}
/**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_pre(){
+ this._sm.worker_pre();
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_do(){
+ this._sm.worker_do();
+ }
+ /**
+ * <p>ExecutionContextããå¼ã³åºãããã¡ã½ããã§ãã</p>
+ */
+ public void invoke_work_post(){
+ this._sm.worker_post();
+ }
+ /**
* <p>StartUpæã«å¼ã³åºãããã¡ã½ããã§ãã</p>
*/
public void invoke_on_startup(){
@@ -1043,10 +1125,40 @@
* @param manager Managerãªãã¸ã§ã¯ã
*/
public static void PeriodicExecutionContextInit(Manager manager) {
- manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext");
+ //manager.registerECFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext");
+ ExecutionContextFactory<ExecutionContextBase,String> factory
+ = ExecutionContextFactory.instance();
+ factory.addFactory("jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
+ new PeriodicExecutionContext(),
+ new PeriodicExecutionContext());
}
/**
+ * {@.ja PeriodicExecutionContext ãçæãã}
+ * {@.en Creats PeriodicExecutionContext}
+ *
+ * @return
+ * {@.ja çæãããinstance}
+ * {@.en Object Created instances}
+ *
+ *
+ */
+ public ExecutionContextBase creator_() {
+ return new PeriodicExecutionContext();
+ }
+ /**
+ * {@.ja Object ãç ´æ£ãã}
+ * {@.en Destructs Object}
+ *
+ * @param obj
+ * {@.ja ç ´æ£ããã¤ã³ã¿ã¹ã¿ã³ã¹}
+ * {@.en The target instances for destruction}
+ *
+ */
+ public void destructor_(Object obj) {
+ obj = null;
+ }
+ /**
* <p>ExecutionContextã®ã¤ã³ã¹ã¿ã³ã¹ãåå¾ãã¾ãã</p>
*
* @return ExecutionContextã¤ã³ã¹ã¿ã³ã¹
@@ -1077,4 +1189,115 @@
return m_obj._is_equivalent((RTC.RTObject)object);
}
}
+
+ /**
+ * {@.ja ExecutionContextã¯ã©ã¹ã®åæåé¢æ°}
+ * {@.en Initialization function of ExecutionContext class}
+ */
+ public void init(Properties props) {
+ }
+
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
+ */
+/*
+ public void setObjRef(final ExecutionContextService ref) {
+ m_profile.setObjRef(ref);
+ }
+*/
+ /**
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§ã®åå¾}
+ * {@.en Get the reference to the CORBA object}
+ * <p>
+ * {@.ja æ¬ãªãã¸ã§ã¯ãã® ExecutioncontextService ã¨ãã¦ã® CORBA ãªãã¸ã§
+ * ã¯ãåç
§ãåå¾ããã}
+ * {@.en Get the reference to the CORBA object as
+ * ExecutioncontextService of this object.}
+ *
+ * @return
+ * {@.ja CORBA ãªãã¸ã§ã¯ãåç
§}
+ * {@.en The reference to CORBA object}
+ *
+ */
+ public ExecutionContextService getObjRef() {
+ return m_profile.getObjRef();
+ }
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãè¨å®ãã}
+ * {@.en Set execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãè¨å®ã
+ * ããå®è¡å¨æã®å¤æ´ã¯ãDataFlowComponentAction ã®
+ * on_rate_changed ã«ãã£ã¦åRTã³ã³ãã¼ãã³ãã«ä¼éãããã}
+ * {@.en This operation shall set the rate (in hertz) at which this
+ * contextâs Active participating RTCs are being called. If the
+ * execution kind of the context is PERIODIC, a rate change shall
+ * result in the invocation of on_rate_changed on any RTCs
+ * realizing DataFlowComponentAction that are registered with any
+ * RTCs participating in the context.}
+ *
+ * @param rate
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ * @return
+ * {@.ja ReturnCode_t åã®ãªã¿ã¼ã³ã³ã¼ã
+ * RTC_OK: æ£å¸¸çµäº
+ * BAD_PARAMETER: è¨å®å¤ãè² ã®å¤}
+ * {@.en The return code of ReturnCode_t type
+ * RTC_OK: Succeed
+ * BAD_PARAMETER: Invalid value. The value might be negative.}
+ *
+ */
+ public ReturnCode_t setRate(double rate) {
+ return m_profile.setRate(rate);
+ }
+ /**
+ * {@.ja ExecutionContext ã®å®è¡å¨æ(Hz)ãåå¾ãã}
+ * {@.en Get execution rate(Hz) of ExecutionContext}
+ * <p>
+ * {@.ja Active ç¶æ
ã«ã¦RTã³ã³ãã¼ãã³ããå®è¡ãããå¨æ(åä½:Hz)ãåå¾ã
+ * ãã}
+ * {@.en This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.}
+ *
+ * @return
+ * {@.ja å¦çå¨æ(åä½:Hz)}
+ * {@.en Execution cycle(Unit:Hz)}
+ *
+ */
+ public double getRate() {
+ return m_profile.getRate();
+ }
+ /**
+ * {@.ja ExecutionKind ãæåååãã}
+ * {@.en Converting ExecutionKind enum to string}
+ * <p>
+ * {@.ja RTC::ExecutionKind ã§å®ç¾©ããã¦ãã PERIODIC, EVENT_DRIVEN,
+ * OTHER ãæåååããã}
+ * {@.en This function converts enumeration (PERIODIC, EVENT_DRIVEN,
+ * OTHER) defined in RTC::ExecutionKind to string.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ * @return
+ * {@.ja æåååãããExecutionKind}
+ * {@.en String of ExecutionKind}
+ *
+ */
+ public final String getKindString(ExecutionKind kind) {
+ return m_profile.getKindString(kind);
+ }
}
More information about the openrtm-commit
mailing list