[openrtm-commit:00452] r2232 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 10月 11日 (火) 01:17:08 JST


Author: n-ando
Date: 2011-10-11 01:17:08 +0900 (Tue, 11 Oct 2011)
New Revision: 2232

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.cpp
   trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.h
   trunk/OpenRTM-aist/src/lib/rtm/RTObject.h
Log:
ConfigAdmin::changedParameters() has been added. RTObject::getConfigService() has been added.

Modified: trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.cpp	2011-10-10 01:09:53 UTC (rev 2231)
+++ trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.cpp	2011-10-10 16:17:08 UTC (rev 2232)
@@ -140,13 +140,15 @@
   void ConfigAdmin::update(const char* config_set)
   {
     if (m_configsets.hasKey(config_set) == NULL) { return; }
-    
+    // clear changed parameter list
+    m_changedParam.clear();
     coil::Properties& prop(m_configsets.getNode(config_set));
     
     for (int i(0), len(m_params.size()); i < len; ++i)
       {
 	if (prop.hasKey(m_params[i]->name) != NULL)
           {
+            // m_changedParam is updated here
             m_params[i]->update(prop[m_params[i]->name].c_str());
           }
       }
@@ -174,7 +176,6 @@
     if (it != m_params.end())
       {
 	(*it)->update(m_configsets[key].c_str());
-        onUpdateParam(config_set, config_param);
 	return;
       }
   }
@@ -495,6 +496,7 @@
   ConfigAdmin::onUpdateParam(const char* config_param, const char* config_value)
   {
     std::cout << "Update: key = " << config_param << " value = " << config_value << std::endl;
+    m_changedParam.push_back(config_param);
     m_listeners.configparam_[ON_UPDATE_CONFIG_PARAM].notify(config_param,
                                                             config_value);
   }

Modified: trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.h	2011-10-10 01:09:53 UTC (rev 2231)
+++ trunk/OpenRTM-aist/src/lib/rtm/ConfigAdmin.h	2011-10-10 16:17:08 UTC (rev 2232)
@@ -878,6 +878,27 @@
      * @endif
      */
     bool isChanged(void) {return m_changed;}
+
+    /*!
+     * @if jp
+     *
+     * @brief 変更されたパラメータのリスト
+     * 
+     * コンフィギュレーションパラメータのうち変更されたもののリストを返す。
+     *
+     * @return 変更されたパラメータ名リスト
+     *
+     * @else
+     *
+     * @brief Changed parameters list
+     * 
+     * This operation returns parameter list which are changed.
+     *
+     * @return Changed parameters list
+     *
+     * @endif
+     */
+    coil::vstring& changedParameters() { return m_changedParam; }
     
     /*!
      * @if jp
@@ -1533,7 +1554,8 @@
     std::string m_activeId;
     bool m_active;
     bool m_changed;
-    std::vector<std::string> m_newConfig;
+    coil::vstring m_changedParam;
+    coil::vstring m_newConfig;
     ConfigurationListeners m_listeners;
 
   };

Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.h	2011-10-10 01:09:53 UTC (rev 2231)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.h	2011-10-10 16:17:08 UTC (rev 2232)
@@ -2256,6 +2256,75 @@
       m_configsets.bindParameter(param_name, var, def_val, trans);
       return true;
     }
+
+    /*!
+     * @if jp
+     *
+     * @brief コンフィギュレーションサービスを取得する
+     * 
+     * コンフィギュレーションサービスオブジェクトを取得する。このサービ
+     * スオブジェクトを利用して、コンフィギュレーションパラメータの操作
+     * を行うことができる。主な操作としては、
+     *
+     * - unbindParameter(): パラメータのアンバインド
+     * - update(): パラメータの更新
+     * - update(set_name): 特定のセットの更新
+     * - update(set_name, param_name): 特定のセットのパラメータの更新
+     * - isExist(): パラメータの存在確認
+     * - isChanged(): パラメータが変更されたかの確認
+     * - changedParameters(): 変更さえたパラメータのリスト
+     * - getActiveId(): アクティブセット名の取得
+     * - haveConfig(config_id): コンフィグセットを持っているかどうか
+     * - getConfigurationSets(): 全コンフィギュレーションセットの取得
+     * - getConfigurationSet(set_id): 特定セットを取得
+     *
+     * コールバック関連 
+     * - addConfigurationParamListener(): リスナの追加
+     * - removeConfigurationParamListener(): リスナの削除
+     * - addConfigurationSetListener(): リスナの追加
+     * - removeConfigurationSetListener(): リスナの削除
+     * - addConfigurationSetNameListener(): リスナの追加
+     * - removeConfigurationSetNameListener(): リスナの削除
+     *
+     * 詳細はConfigAdminクラスリファレンスを参照のこと。
+     *
+     * @return ConfigAdmin object
+     * 
+     * @else
+     *
+     * @brief Getting configuration service
+     * 
+     * This operation returns configuration service object. By using
+     * this service, user can manipulate configuration
+     * parameters. Mainly the following operations are supported.
+     *
+     * - unbindParameter(): Unbinding parameters
+     * - update(): Updateing parameters
+     * - update(set_name): Updating a specific configuration set
+     * - update(set_name, param_name): Updating specific parameter in a set
+     * - isExist(): Checking existence of a parameter
+     * - isChanged(): Check if a parameter was updated
+     * - changedParameters(): Getting changed parameter list
+     * - getActiveId(): Getting active configuration set name
+     * - haveConfig(config_id): Checking if having a specified configuration set
+     * - getConfigurationSets(): getting all the configuration sets
+     * - getConfigurationSet(set_id): Getting a configuration set
+     *
+     * Callback related member functions
+     * - addConfigurationParamListener(): Adding listener
+     * - removeConfigurationParamListener(): Removing listener
+     * - addConfigurationSetListener(): Adding listener
+     * - removeConfigurationSetListener(): Removing listener
+     * - addConfigurationSetNameListener(): Adding listener
+     * - removeConfigurationSetNameListener(): Removing listener
+     *
+     * See details in the ConfigAdmin class reference
+     *
+     * @return ConfigAdmin object
+     *
+     * @endif
+     */
+    ConfigAdmin& getConfigService() { return m_configsets; }
     
     /*!
      * @if jp



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