[openrtm-commit:00370] r2220 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 8月 25日 (木) 00:35:53 JST


Author: n-ando
Date: 2011-08-25 00:35:53 +0900 (Thu, 25 Aug 2011)
New Revision: 2220

Added:
   trunk/OpenRTM-aist/src/lib/rtm/ListenerHolder.h
   trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.cpp
   trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.h
   trunk/OpenRTM-aist/src/lib/rtm/LocalServiceBase.h
   trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.cpp
   trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.h
Modified:
   trunk/OpenRTM-aist/src/lib/rtm/
   trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
   trunk/OpenRTM-aist/src/lib/rtm/Makefile.am
   trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
   trunk/OpenRTM-aist/src/lib/rtm/Manager.h
Log:
LocalService framework to realize additional services in the manager has been introduced.
Manager's call-backs to hook manager's events (manager, naming, RTC creation, etc.) have been implemented.


Property changes on: trunk/OpenRTM-aist/src/lib/rtm
___________________________________________________________________
Modified: svn:ignore
   - Makefile
Makefile.in
.deps
config_rtc.h.in
config_rtc.h
stamp-h1
version.h

   + Makefile
Makefile.in
.deps
config_rtc.h.in
config_rtc.h
stamp-h1
version.h

version.txt


Modified: trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h	2011-08-23 22:31:13 UTC (rev 2219)
+++ trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -105,6 +105,7 @@
     "manager.modules.Java.profile_cmd",      "rtcprof_java",
     "manager.modules.Java.suffixes",         "class",
     "manager.modules.Java.load_paths",       "./",
+    "manager.local_service.enabled_services","ALL",
     "sdo.service.provider.enabled_service",  "ALL",
     "sdo.service.consumer.enabled_service",  "ALL",
     ""

Added: trunk/OpenRTM-aist/src/lib/rtm/ListenerHolder.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ListenerHolder.h	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/ListenerHolder.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,257 @@
+// -*- C++ -*-
+/*!
+ * @file ListnerHolder.h
+ * @brief Listener holder class
+ * @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$
+ *
+ */
+
+#ifndef RTM_UTIL_LISTENERHOLDER_H
+#define RTM_UTIL_LISTENERHOLDER_H
+
+#include <vector>
+#include <utility>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
+#include <coil/NonCopyable.h>
+
+namespace RTM
+{
+namespace util
+{
+  /*!
+   * @if jp
+   * @class Listener ホルダークラス
+   *
+   * このクラスは、リスナクラスの単純な保持、管理を行うリスナホルダクラ
+   * スである。このクラスを利用するためには、テンプレートの第1引数に当
+   * たるリスナクラス (Listenerクラス) および、このListenerHolderクラス
+   * テンプレートを継承して、実際にリスナの呼び出しを行う
+   * ListenerHolder実装クラスを実装する必要がある。
+   *
+   * このクラスは、スレッドセーブを実現するため、リスナの追加と削除につ
+   * いてはミューテックスによるロックを行っている。完全にスレッドセーフ
+   * なリスナ管理を実現するためにはリスナのコールバックをコールする際に
+   * もミューテックするによるロックを行う必要がある。
+   *
+   * @section Listenerクラスの定義
+   *
+   * イベント発生時にコールバックされるメンバ関数を持つ基底クラスを定義
+   * する。コールバックのためのメンバ関数は、任意の戻り値、引数を持つも
+   * のが定義でき、通常の関数であってもよいし、operator()などのファンク
+   * タとして定義してもよい。実際には基底クラスにてこれらの関数を純粋仮
+   * 想関数として定義し、このクラスを継承して、実際のリスナクラスを実装
+   * することになる。また、ひとつのリスナクラスに複数にコールバック関数
+   * を定義してもよい。実際には、これらのコールバック関数を実際に呼び出
+   * す方法に関しては、次のListenerHolder実装クラスにて詳しく定義するこ
+   * とになる。
+   * <pre>
+   * class MyListenerBase
+   * {
+   * public:
+   *   // コールバック関数1: 関数呼び出し演算子によるコールバック関数
+   *   // いわゆるファンクタのようにコールバック関数を定義する例。
+   *   virtual void operator()(std::string strarg) = 0; // 純粋仮想関数
+   *   
+   *   // コールバックの関数シグニチャが多様である場合、このように単な
+   *   // るメンバ関数として定義することも可能。
+   *   virtual void onEvent0(const char* arg0) = 0;
+   *   virtual void onEvent1(int arg0) = 0;
+   *   virtual void onEvent2(double arg0) = 0;
+   *   virtual void onEvent3(HogeProfile& arg0) = 0;
+   * };
+   * </pre>
+   *
+   * @section ListenerHolder実装クラス
+   *
+   * ListenerHolder実装クラスはこのLsitenerHolderクラステンプレートを継
+   * 承して、上で定義した MyListenerBase クラスの追加と削除など管理を行
+   * い、かつ実際にコールバック関数を呼び出す部分を実装することになる。
+   * 実際にコールバックを呼び出す部分では、関数シグニチャが多種多様であっ
+   * たり、ひとつのリスナクラスが複数のコールバック関数を持つ場合がある
+   * ため、個別のリスナクラスに対応するため、この呼び出し部分が必要とな
+   * る。ListenerHolder実装クラスは、MyListenerBaseクラスと同じシグニチャ
+   * を持つメンバ関数をもち、関数内部では、ListenerHolderクラスが持つ、
+   * m_listeners, m_mutex のこれら二つのメンバ変数を利用して、登録され
+   * たリスナオブジェクトのメンバ変数を呼び出す。
+   *
+   * <pre>
+   * class MyListenerHolderImpl
+   *  : public ::RTM::util::ListenerHolder<MyListenerBase>
+   * {
+   * public:
+   *   // 関数呼び出し演算子のコールバック関数の場合
+   *   virtual void operator()(std::string strarg)
+   *   {
+   *     Gurad gurad(m_mutex);
+   *     for (int i(0), len(m_listeners.size()); i < len; ++i)
+   *     {
+   *       m_listeners[i].first->operator()(strarg);
+   *     }
+   *   }
+   *
+   *   virtual void onEvent0(const char* arg0)
+   *   {
+   *     Gurad gurad(m_mutex);
+   *     for (int i(0), len(m_listeners.size()); i < len; ++i)
+   *     {
+   *       m_listeners[i].first->onEvent(arg0);
+   *     }
+   *   }
+   * };
+   * </pre>
+   *
+   * リスナオブジェクトへのポインタを格納しているEntryオブジェクトは
+   * std::pair<ListenerClass, bool> として定義されており、firstが
+   * Listenerオブジェクトへのポインタ、secondが自動削除フラグである。し
+   * たがって、リスナオブジェクトへアクセスする場合にはfirstを使用する。
+   * マルチスレッド環境で利用することが想定される場合は、Guard
+   * guard(m_mutex) によるロックを忘れずに行うこと。
+   * 
+   * @section ListenerHolder実装クラスの利用
+   * 実装されたMyListenerHolderImplは一例として以下のように利用する。
+   *
+   * <pre>
+   * // たとえばクラスメンバとして宣言
+   * MyListenerHolderImpl m_holder;
+   *
+   * // 登録、自動クリーンモードで登録、
+   * // オブジェクトの削除はHolderクラスに任せる
+   * m_holder.addListener(new MyListener0(), true); // MyListener0の
+   * 
+   * // コールバックを呼び出す
+   * m_holder.operator()(strarg);
+   * m_holder.onEvent0("HogeHoge);
+   * </pre>
+   *
+   * @else
+   *
+   * @class Listener holder class
+   *
+   * @endif
+   */
+  template <typename ListenerClass>
+  class ListenerHolder
+    : public coil::NonCopyable
+  {
+  public:
+    typedef coil::Guard<coil::Mutex> Guard;
+    typedef std::pair<ListenerClass*, bool> Entry;
+    typedef std::vector<Entry> EntryList;
+    typedef typename EntryList::iterator EntryIterator;
+
+    /*!
+     * @if jp
+     * @brief ListenerHolderクラスコンストラクタ
+     * @else
+     * @brief ListenerHolder class ctor 
+     * @endif
+     */
+    ListenerHolder()
+    {
+    }
+
+    /*!
+     * @if jp
+     * @brief ListenerHolderデストラクタ
+     * @else
+     * @brief ListenerHolder class dtor 
+     * @endif
+     */
+    virtual ~ListenerHolder()
+    {
+      Guard guard(m_mutex);
+      EntryIterator it(m_listeners.begin());
+      
+      for (; it != m_listeners.end(); ++it)
+        {
+          if ((*it).second)
+            {
+              delete (*it).first;
+            }
+          m_listeners.erase(it);
+        }
+    }
+  
+    /*!
+     * @if jp
+     * @brief リスナを追加する
+     * @else
+     * @brief add listener object
+     * @endif
+     */
+    virtual void addListener(ListenerClass* listener,
+                     bool autoclean)
+    {
+      Guard guard(m_mutex);
+      m_listeners.push_back(Entry(listener, autoclean));
+    }
+    
+    /*!
+     * @if jp
+     * @brief リスナを削除する
+     * @else
+     * @brief remove listener object
+     * @endif
+     */
+    virtual void removeListener(ListenerClass* listener)
+    {
+      Guard guard(m_mutex);
+      EntryIterator it(m_listeners.begin());
+      
+      for (; it != m_listeners.end(); ++it)
+        {
+          if ((*it).first == listener)
+            {
+              if ((*it).second)
+                {
+                  delete (*it).first;
+                }
+              m_listeners.erase(it);
+              return;
+            }
+        }
+    }
+
+  protected:
+    /*!
+     * @if jp
+     * @brief Mutex
+     * @else
+     * @brief Mutex
+     * @endif
+     */
+    coil::Mutex m_mutex;
+
+    /*!
+     * @if jp
+     * @brief リスナのリスト
+     * @else
+     * @brief List of listener object
+     * @endif
+     */
+    EntryList m_listeners;
+  };
+}; // util
+}; // RTM
+
+#define LISTENERHOLDER_CALLBACK(func, args)               \
+  {                                                       \
+    Guard guard(m_mutex);                                 \
+    for (int i(0), len(m_listeners.size()); i < len; ++i) \
+      {                                                   \
+        m_listeners[i].first->func args;                  \
+      }                                                   \
+  }
+
+#endif // RTM_UITL_LISTENERHOLDER_H


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/ListenerHolder.h
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain

Added: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.cpp	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.cpp	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,287 @@
+// -*- C++ -*-
+/*!
+ * @file LocalServiceAdmin.cpp
+ * @brief SDO service administration class
+ * @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: SdoConfiguration.cpp 1971 2010-06-03 08:46:40Z n-ando $
+ *
+ */
+
+#include <memory>
+#include <algorithm>
+
+#include <coil/UUID.h>
+#include <coil/Guard.h>
+#include <coil/stringutil.h>
+
+#include <rtm/RTObject.h>
+#include <rtm/CORBA_SeqUtil.h>
+#include <rtm/LocalServiceAdmin.h>
+#include <rtm/LocalServiceBase.h>
+
+namespace RTM
+{
+  /*!
+   * @if jp
+   * @brief コンストラクタ
+   * @else
+   * @brief Constructor
+   * @endif
+   */
+  LocalServiceAdmin::LocalServiceAdmin()
+    : rtclog("LocalServiceAdmin")
+  {
+    RTC_TRACE(("LocalServiceAdmin::LocalServiceAdmin()"));
+  }
+  
+  /*!
+   * @if jp
+   * @brief 仮想デストラクタ
+   * @else
+   * @brief Virtual destractor
+   * @endif
+   */
+  LocalServiceAdmin::~LocalServiceAdmin()
+  {
+    finalize();
+  }
+  
+  /*!
+   * @if jp
+   * @brief "all" 文字列探索Functor
+   * @else
+   * @brief A functor to search "all"
+   * @endif
+   */
+  struct find_all
+  {
+    bool operator()(const std::string& str)
+    {
+      std::string a = str;
+      return coil::normalize(a) == "all" ? true : false;
+    }
+  };
+  
+  /*!
+   * @if jp
+   *
+   * @brief LocaServiceAdminの初期化
+   * @else
+   * @brief Initialization of LocalServiceAdmin
+   * @endif
+   */
+  void LocalServiceAdmin::init(coil::Properties& props)
+  {
+    RTC_TRACE(("LocalServiceAdmin::init():"));
+    RTC_DEBUG_STR((props));
+    coil::vstring svcs(coil::split(props["enabled_services"], ","));
+    find_all fa();
+    bool all_enable(false);
+    if (std::find_if(svcs.begin(), svcs.end(), find_all()) != svcs.end())
+      {
+        RTC_INFO(("All the local services are enabled."));
+        all_enable = true;
+      }
+    
+    RTM::LocalServiceFactory& factory(RTM::LocalServiceFactory::instance());
+    coil::vstring ids = factory.getIdentifiers();
+    RTC_DEBUG(("Available services: %s", coil::flatten(ids).c_str()));
+    
+    for (size_t i(0); i < ids.size(); ++i)
+      {
+        if (all_enable || isEnabled(ids[i], svcs))
+          {
+            if (notExisting(ids[i]))
+              {
+                LocalServiceBase* service(factory.createObject(ids[i]));
+                RTC_DEBUG(("Service created: %s", ids[i].c_str()));
+                coil::Properties& prop(props.getNode(ids[i]));
+                service->init(prop);
+                addLocalService(service);
+              }
+          }
+      }
+  }
+  
+  /*!
+   * @if jp
+   * @brief LocalserviceAdmin の終了処理
+   * @else
+   * @brief Finalization ofLocalServiceAdmin
+   * @endif
+   */
+  void LocalServiceAdmin::finalize()
+  {
+    RTM::LocalServiceFactory& factory(RTM::LocalServiceFactory::instance());
+    for (size_t i(0); i < m_services.size(); ++i)
+      {
+        m_services[i]->finalize();
+        factory.deleteObject(m_services[i]);
+      }
+    m_services.clear();
+  }
+  
+  /*!
+   * @if jp
+   * @brief LocalServiceProfileListの取得
+   * @else
+   * @brief Getting LocalServiceProfileList
+   * @endif
+   */
+  RTM::LocalServiceProfileList LocalServiceAdmin::getServiceProfiles()
+  {
+    RTM::LocalServiceProfileList profs;
+    for (size_t i(0); i < m_services.size(); ++i)
+      {
+        profs.push_back(m_services[i]->getProfile());
+      }
+    return profs;
+  }
+  
+  /*!
+   * @if jp
+   * @brief LocalServiceProfile を取得する
+   * @else
+   * @brief Get LocalServiceProfile of an LocalService
+   * @endif
+   */
+  bool
+  LocalServiceAdmin::getServiceProfile(std::string name,
+                                       ::RTM::LocalServiceProfile& prof)
+  {
+    Guard guard(m_services_mutex);
+    for (size_t i(0); i < m_services.size(); ++i)
+      {
+        if (name == m_services[i]->getProfile().name)
+          {
+            prof = m_services[i]->getProfile();
+            return true;
+          }
+      }
+    return false;
+  }
+  
+  /*!
+   * @if jp
+   * @brief LocalService の Service を取得する
+   * @else
+   * @brief Get a pointer of a LocalService
+   * @endif
+   */
+  RTM::LocalServiceBase* LocalServiceAdmin::getService(const char* id)
+  {
+    for (size_t i(0); i < m_services.size(); ++i)
+      {
+        if (m_services[i]->getProfile().name == id)
+          {
+            return m_services[i];
+          }
+      }
+    return NULL;
+  }
+  
+  /*!
+   * @if jp
+   * @brief SDO service provider をセットする
+   * @else
+   * @brief Set a SDO service provider
+   * @endif
+   */
+  bool
+  LocalServiceAdmin::addLocalService(::RTM::LocalServiceBase* service)
+  {
+    if (service == NULL)
+      {
+        RTC_ERROR(("Invalid argument: addLocalService(service == NULL)"));
+        return false;
+      }
+    RTC_TRACE(("LocalServiceAdmin::addLocalService(%s)",
+               service->getProfile().name.c_str()));
+    Guard guard(m_services_mutex);
+    m_services.push_back(service);
+    return true;
+  }
+  
+  /*!
+   * @if jp
+   * @brief LocalService を削除する
+   * @else
+   * @brief Remove a LocalService
+   * @endif
+   */
+  bool LocalServiceAdmin::removeLocalService(const std::string name)
+  {
+    RTC_TRACE(("removeLocalService(%d)", name.c_str()));
+    Guard gurad(m_services_mutex);
+    
+    std::vector<LocalServiceBase*>::iterator it = m_services.begin();
+    std::vector<LocalServiceBase*>::iterator it_end = m_services.end();
+    while (it != it_end)
+      {
+        if (name == (*it)->getProfile().name)
+          {
+            (*it)->finalize();
+            LocalServiceFactory&
+              factory(LocalServiceFactory::instance());
+            factory.deleteObject(*it);
+            m_services.erase(it);
+            RTC_INFO(("SDO service  has been deleted: %s", name.c_str()));
+            return true;
+          }
+        ++it;
+      }
+    RTC_WARN(("Specified SDO service  not found: %s", name.c_str()));
+    return false;
+  }
+  
+  //============================================================
+  // private functions
+  /*!
+   * @if jp
+   * @brief 指定されたIDが有効かどうかチェックする
+   * @else
+   * @brief Check if specified ID is enabled
+   * @endif
+   */
+  bool LocalServiceAdmin::isEnabled(const std::string& id,
+                                    const coil::vstring& enabled)
+  {
+    bool ret = std::find(enabled.begin(), enabled.end(), id) != enabled.end();
+    RTC_DEBUG(("Local service %s %s enabled.", id.c_str(),
+               ret ? "is" : "is not"));
+    return ret;
+  }
+  
+  
+  /*!
+   * @if jp
+   * @brief 指定されたIDがすでに存在するかどうかチェックする
+   * @else
+   * @brief Check if specified ID is existing
+   * @endif
+   */
+  bool LocalServiceAdmin::notExisting(const std::string& id)
+  {
+    Guard gurad(m_mutex);
+    for (size_t i(0); i < m_services.size(); ++i)
+      {
+        if (m_services[i]->getProfile().name == id)
+          {
+            RTC_WARN(("Local service %s already exists.", id.c_str()));
+            return false;
+          }
+      }
+    RTC_DEBUG(("Local service %s does not exist.", id.c_str()));
+    return true;
+  }
+  
+}; // end of namepsace RTM


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.cpp
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain

Added: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.h	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,276 @@
+// -*- C++ -*-
+/*!
+ * @file LocalServiceAdmin.h
+ * @brief SDO service administration class
+ * @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: SdoConfiguration.cpp 1971 2010-06-03 08:46:40Z n-ando $
+ *
+ */
+
+#ifndef RTC_LOCALSERVICEADMIN_H
+#define RTC_LOCALSERVICEADMIN_H
+
+#include <coil/Mutex.h>
+#include <coil/Factory.h>
+#include <coil/Singleton.h>
+
+#include <rtm/idl/SDOPackageStub.h>
+#include <rtm/SystemLogger.h>
+#include <rtm/LocalServiceBase.h>
+
+namespace RTM
+{
+  // forward decl
+  class LocalServiceBase;
+  typedef LocalServiceBase* (*ECNewFunc)();
+  typedef void (*ECDeleteFunc)(LocalServiceBase* ls);
+  typedef coil::Guard<coil::Mutex> Guard;
+
+  /*!
+   * @if jp
+   *
+   * @class LocalService administration class
+   * @brief LocalService 管理クラス
+   *
+   * TODO: Documentation
+   *
+   * @since 1.1.0
+   *
+   *
+   * @else
+   *
+   * @class SDO service administration class
+   * @brief SDO service administration class
+   *
+   * TODO: Documentation
+   *
+   * @since 1.1.0
+   *
+   * @endif
+   */
+  class LocalServiceAdmin
+    : public coil::Singleton<LocalServiceAdmin>
+  {
+  public:
+    /*!
+     * @if jp
+     *
+     * @brief コンストラクタ
+     * 
+     * コンストラクタ
+     *
+     * @else
+     *
+     * @brief Constructor
+     * 
+     * Constructor
+     *
+     * @endif
+     */
+    LocalServiceAdmin();
+    
+    /*!
+     * @if jp
+     *
+     * @brief 仮想デストラクタ
+     * 
+     * 仮想デストラクタ。
+     * 
+     * @else
+     *
+     * @brief Virtual destractor
+     *
+     * Virtual destractor.
+     *
+     * @endif
+     */
+    virtual ~LocalServiceAdmin();
+    
+    /*!
+     * @if jp
+     *
+     * @brief LocaServiceAdminの初期化
+     *
+     * TODO: Documentation
+     *
+     * @else
+     *
+     * @brief Initialization of LocalServiceAdmin
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    void init(coil::Properties& props);
+    
+    /*!
+     * @if jp
+     *
+     * @brief LocalserviceAdmin の終了処理
+     *
+     * TODO: Documentation
+     *
+     * @else
+     *
+     * @brief Finalization ofLocalServiceAdmin
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    void finalize();
+    
+    /*!
+     * @if jp
+     *
+     * @brief LocalServiceProfileListの取得
+     * 
+     * TODO: Documentation
+     *
+     * @else
+     *
+     * @brief Getting LocalServiceProfileList
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    ::RTM::LocalServiceProfileList getServiceProfiles();
+    
+    /*!
+     * @if jp
+     *
+     * @brief LocalServiceProfile を取得する
+     *
+     * id で指定されたIDを持つLocalService の
+     * LocalServiceProfile を取得する。id が NULL ポインタの場合、指定された
+     * id に該当するServiceProfile が存在しない場合、falseを返す。
+     *
+     * @param id LocalService の IFR ID
+     * @return 指定された id を持つ LocalServiceProfile
+     * 
+     * @else
+     *
+     * @brief Get LocalServiceProfile of an LocalService
+     *
+     * This operation returns LocalServiceProfile of a LocalService
+     * which has the specified id. If the specified id is
+     * NULL pointer or the specified id does not exist in the
+     * ServiceProfile list, false will be returned.
+     *
+     * @param id ID of an LocalService
+     * @return LocalServiceProfile which has the specified id
+     *
+     * @endif
+     */
+    bool getServiceProfile(std::string name,
+                           ::RTM::LocalServiceProfile& prof);
+    
+    /*!
+     * @if jp
+     *
+     * @brief LocalService の Service を取得する
+     *
+     * id で指定されたIDを持つLocalService のポインタを取得する。id が
+     * NULL ポインタの場合、指定された id に該当するServiceProfile が存
+     * 在しない場合、NULLを返す。
+     *
+     * @param id LocalService の ID
+     * @return 指定された id を持つ LocalService のポインタ
+     * 
+     * @else
+     *
+     * @brief Get a pointer of a LocalService
+     *
+     * This operation returnes a pointer to the LocalService
+     * which has the specified id. If the specified id is
+     * NULL pointer or the specified id does not exist in the
+     * ServiceProfile list, NULL pointer will be returned.
+     *
+     * @param id ID of a LocalService
+     * @return a pointer which has the specified id
+     *
+     * @endif
+     */
+    ::RTM::LocalServiceBase* getService(const char* id);
+    
+    /*!
+     * @if jp
+     * @brief SDO service provider をセットする
+     *
+     * TODO: Documentation
+     * 
+     * @else
+     * @brief Set a SDO service provider
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    bool addLocalService(::RTM::LocalServiceBase* service);
+    
+    /*!
+     * @if jp
+     * @brief LocalService を削除する
+     *
+     * TODO: Documentation
+     *
+     * @else
+     * @brief Remove a LocalService
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    bool removeLocalService(const std::string name);
+    
+  private:
+    /*!
+     * @if jp
+     * @brief 指定されたIDが有効かどうかチェックする
+     * @else
+     * @brief Check if specified ID is enabled
+     * @endif
+     */
+    bool isEnabled(const std::string& id, const coil::vstring& enabled);
+    
+    /*!
+     * @if jp
+     * @brief 指定されたIDがすでに存在するかどうかチェックする
+     * @else
+     * @brief Check if specified ID is existing
+     * @endif
+     */
+    bool notExisting(const std::string& id);
+    
+    /*!
+     * @if jp
+     * @brief Lock 付き SDO ServiceProfileList
+     * @else
+     * @brief SDO ServiceProfileList with mutex lock
+     * @endif
+     */
+    std::vector<LocalServiceBase*> m_services;
+    coil::Mutex m_services_mutex;
+    
+    /*!
+     * @if jp
+     * @brief logger
+     * @else
+     * @brief logger
+     * @endif
+     */
+    ::RTC::Logger rtclog;
+  };
+}; // RTM
+
+#endif // RTC_LOCALSERVICEADMIN_H


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceAdmin.h
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain

Added: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceBase.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/LocalServiceBase.h	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/LocalServiceBase.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,299 @@
+// -*- C++ -*-
+/*!
+ * @file LocalServiceBase.h
+ * @brief Local service provider base class and its factory
+ * @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$
+ *
+ */
+
+#ifndef RTM_LOCALSERVICEBASE_H
+#define RTM_LOCALSERVICEBASE_H
+
+#include <vector>
+
+#include <coil/Mutex.h>
+#include <coil/Factory.h>
+#include <coil/Timer.h>
+#include <coil/Properties.h>
+
+namespace RTM
+{
+  
+  // forward decl
+  class LocalServiceBase;
+  
+  /*!
+   * @if jp
+   * @brief LocalServiceのプロファイルデータ
+   * @else
+   * @brief Profile data structure of LocalService
+   * @endif
+   */
+  class LocalServiceProfile
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief LocalServiceのサービス名
+     * @else
+     * @brief The name of LocalService
+     * @endif
+     */
+    std::string name;
+    /*!
+     * @if jp
+     * @brief LocalServiceの固有ID
+     * @else
+     * @brief The unique ID of LocalService
+     * @endif
+     */
+    std::string uuid;
+    /*!
+     * @if jp
+     * @brief LocalServiceのプロパティ
+     * @else
+     * @brief Properties of LocalService
+     * @endif
+     */
+    coil::Properties properties;
+    /*!
+     * @if jp
+     * @brief LocalServiceのポインタ
+     * @else
+     * @brief The pointer to LocalService
+     * @endif
+     */
+    LocalServiceBase* service;
+  };
+  
+  /*!
+   * @if jp
+   * @brief LocalServiceのリスト
+   * @else
+   * @brief List of LocalServiceProfile
+   * @endif
+   */
+  typedef std::vector<LocalServiceProfile> LocalServiceProfileList;
+  
+  /*!
+   * @if jp
+   *
+   * @brief LocalService 基底クラス
+   *
+   * Local Service とは RT-Middlewareのマネージャデーモン内で各種サービ
+   * スを提供するための仕組みである。Local Serviceにはいくつかのユース
+   * ケースが考えられる。
+   *
+   * 1. RTCの内部ロジックに対してサービスを提供する。コンポーネントの開
+   * 発者は、一定の艇順を経て、Local Serviceのインスタンスへの参照を得
+   * て、このサービスを利用することができる。
+   *
+   * 2. マネージャ等に機能を追加するためのサービス。たとえは、RTCの名前
+   * を登録するCORBAネームサービスの代わりに、新たなディレクトリサービ
+   * スやブロードキャストによる名前通知機能などを新たな機能をマネージャ
+   * に追加するために利用することができる。マネージャには、様々なアクショ
+   * ンに対するフックが用意されており、これを利用することで、マネージャ
+   * の様々なイベントに対してアクションを起こすことができる。
+   *
+   * 3. マネージャは自身のサービス以外に付加的に外部に対してサービスを
+   * 提供する機能を有する。外部からCORBA経由で、ローカルの機能、たとえ
+   * ばデバイスやリソースのマネジメント機能に対してアクセスする方法を提
+   * 供する。サービスのインスタンス化後に、マネージャに対して、マネージャ
+   * サービスとして登録することで、外部からのアクセスを受け付けることが
+   * できるようになる。
+   *
+   * Local Service はモジュールとしてロードされ、通常唯一のインスタンス
+   * が生成される。すなわち、LocalService はシングルトンとして実装され
+   * る。インスタンス化されたサービスはサービスリストに登録され、RTC等
+   * からは名前やUUIDによってインスタンスの参照を入手することができる。
+   *
+   * このオブジェクトのライフサイクルは以下の通り。
+   *
+   * -# オブジェクトは通常、共有オブジェクト (so, DLL) としてコンパイル・
+   *    リンクされる。
+   * -# マネージャに対してロードされるとモジュール初期化関数によりオブ
+   *    ジェクトファクトリが、LocalServiceFactory に対して登録される。
+   *    登録のキーにはUUIDと名前が利用され、これによりサービスが区別さ
+   *    れる。
+   * -# rtc.conf等のコンフィギュレーション指定により、有効化することが
+   *    指定されているサービスインプロバイダは、RTCの起動と同時にインス
+   *    タンス化される。
+   * -# インスタンス化後、初期化関数 init() が呼ばれる。引数には当該サー
+   *    ビスのためのコンフィギュレーションオプションが coil::Propertyに
+   *    より渡される。
+   * -# マネージャサービスオペレーション reinit が呼ばれると、すべての
+   *     Local Service お reinit が呼び出され、更新されたコンフィギュレー
+   *     ション情報が読み込まれる。
+   * -# マネージャ解体時には、すべての Local Service の finalizeが呼び
+   *       出され、解体されるので、ここでリソースの解放など終了処理を行
+   *       う。
+   *
+   * このクラスの実装に当たっては、少なくとも以下の純粋仮想関数を実装す
+   * る必要がある。
+   *
+   * - init(): 初期化関数。与えられた RTObject および ServiceProfile か
+   *   ら、当該オブジェクトを初期化する。
+   * - reinit(): 再初期化関数。ServiceProfile は設定情報更新のため同一
+   *   IDで呼び出されることが有るが、その際にこの関数が新たな
+   *   ServiceProfile とともに呼び出される。関数内では、設定の変更など
+   *   再初期化処理を実装する。
+   * - getProfile(): 設定されたプロファイルを返す関数。
+   * - finalize(): 終了処理。コンシューマがデタッチされる際に呼び出され
+   *   る関数。関数内では終了処理を実装する。
+   *
+   * LocalService は通常共有オブジェクトとしてコンパイル・リンク
+   * される。共有オブジェクトのエントリポイントは通常コンパイルされたファ
+   * イル名の basename + "Init" にしておく。以下に、クラス名、ファイル
+   * 名、エントリポイント関数名の推奨例を示す。
+   *
+   * - 実装クラス名: MyLocalService
+   * - ファイル名: MyLocalService.h. MyLocalService.cpp
+   * - 共有オブジェクト名: MyLocalService.so (or DLL)
+   * - エントリポイント関数名: MyLocalServiceInit()
+   *
+   * エントリポイント関数は通常以下のように、LocalServiceFactory
+   * に当該コンシューマのファクトリ (と解体ファンクタ) を登録する以下の
+   * ような関数になる。
+   *
+   * <pre>
+   * extern "C"
+   * {
+   *   void MyLocalServiceInit()
+   *   {
+   *     RTC::LocalServiceFactory& factory
+   *       = RTC::LocalServiceFactory::instance();
+   *     factory.addFactory(::RTC::MyLocalSerivce::name,
+   *                        ::coil::Creator< ::RTC::LocalServiceBase,
+   *                        ::RTC::MyLocalService>,
+   *                        ::coil::Destructor< ::RTC::LocalServiceBase,
+   *                        ::RTC::MyLocalService>);
+   *   }
+   * };
+   * </pre>
+   *
+   * @else
+   *
+   * @endif
+   *
+   */
+  class LocalServiceBase
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief 仮想デストラクタ
+     * @else
+     * @brief virtual destructor
+     * @endif
+     */
+    virtual ~LocalServiceBase()
+    {
+    }
+    
+    /*!
+     * @if jp
+     * @brief LocalServiceクラスの初期化関数
+     *
+     * このオブジェクトの初期化を行う。LocalService を実装する場合、外
+     * 部からの設定情報は、このinit()関数により与えられる。
+     *
+     * @param profile 外部から与えられた LocalServiceProfile
+     * @return 与えられた LocalServiceProfile が不正の場合 false
+     *
+     * @else
+     * @brief Initialization function of the LocalService class
+     *
+     * @endif
+     */
+    virtual bool
+    init(const coil::Properties& props) = 0;
+    /*!
+     * @if jp
+     * @brief LocalServiceクラスの再初期化関数
+     *
+     * TODO: ドキュメント作成
+     *
+     * @param profile 新たに与えられた LocalServiceProfile
+     * @return 不正な LocalServiceProfile が与えられた場合は false
+     *
+     * @else
+     * @brief Reinitialization function of the LocalService class
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    virtual bool
+    reinit(const coil::Properties& props) = 0;
+    
+    /*!
+     * @if jp
+     * @brief LocalServiceProfile を返す
+     *
+     * init()/reinit()で与えられた LocalServiceProfile は通常オブジェク
+     * ト内で保持される。この関数では保持されている ServiceProfile を返
+     * す。
+     *
+     * @return このオブジェクトが保持している LocalServiceProfile
+     *
+     * @else
+     * @brief Getting LocalServiceProfile
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    virtual const LocalServiceProfile&
+    getProfile() const = 0;
+    
+    /*!
+     * @if jp
+     * @brief 終了処理
+     *
+     * LocalService が終了する際に呼び出される終了処理用関数。当該オブ
+     * ジェクトが保持するリソースを解放するなどの処理を行う。
+     *
+     * @else
+     * @brief Finalization
+     *
+     * TODO: Documentation
+     *
+     * @endif
+     */
+    virtual void
+    finalize() = 0;
+  };
+  
+  /*!
+   * @if jp
+   * @brief LocalServiceFactory の typedef
+   * @else
+   * @brief typedef of sdoServiceProviderFactory
+   * @endif
+   */
+  typedef ::coil::GlobalFactory< ::RTM::LocalServiceBase > LocalServiceFactory;
+  
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
+  /*!
+   * @if jp
+   * @brief クラステンプレートの明示的インスタンス化
+   * @else
+   * @brief Explicit instantiation of class template
+   * @endif
+   */
+  EXTERN template class DLL_PLUGIN
+  ::coil::GlobalFactory< ::RTM::LocalServiceBase >;
+#endif
+}; // namespace RTM
+
+#endif // RTM_LOCALSERVICEBASE_H


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/LocalServiceBase.h
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain

Modified: trunk/OpenRTM-aist/src/lib/rtm/Makefile.am
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Makefile.am	2011-08-23 22:31:13 UTC (rev 2219)
+++ trunk/OpenRTM-aist/src/lib/rtm/Makefile.am	2011-08-24 15:35:53 UTC (rev 2220)
@@ -58,7 +58,9 @@
 	NamingManager.cpp            \
 	NumberingPolicy.cpp          \
 	ManagerServant.cpp           \
-	SystemLogger.cpp
+	SystemLogger.cpp             \
+	LocalServiceAdmin.cpp        \
+	ManagerActionListener.cpp
 
 COMP_SRC =                           \
 	DataFlowComponentBase.cpp    \
@@ -150,6 +152,8 @@
 	SdoServiceConsumerBase.h \
 	StateMachine.h 		 \
 	Typename.h               \
+	LocalServiceBase.h	 \
+	ListenerHolder.h         \
 	config_rtc.h
 
 

Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2011-08-23 22:31:13 UTC (rev 2219)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2011-08-24 15:35:53 UTC (rev 2220)
@@ -39,6 +39,7 @@
 #include <rtm/FactoryInit.h>
 #include <rtm/CORBA_IORUtil.h>
 #include <rtm/SdoServiceConsumerBase.h>
+#include <rtm/LocalServiceAdmin.h>
 
 #if defined(minor)
 #undef minor
@@ -154,6 +155,7 @@
 	    manager->initExecContext();
 	    manager->initComposite();
 	    manager->initTimer();
+            manager->initManagerServant();
 	  }
       }
     return *manager;
@@ -182,6 +184,7 @@
   void Manager::shutdown()
   {
     RTC_TRACE(("Manager::shutdown()"));
+    m_listeners.manager_.preShutdown();
     shutdownComponents();
     shutdownNaming();
     shutdownORB();
@@ -195,6 +198,7 @@
       {
 	join();
       }
+    m_listeners.manager_.postShutdown();
     shutdownLogger();
   }
   
@@ -293,6 +297,8 @@
     m_config["sdo.service.consumer.available_services"]
       = coil::flatten(SdoServiceConsumerFactory::instance().getIdentifiers());
 
+    initLocalService();
+
     if (m_initProc != NULL)
       {
         m_initProc(this);
@@ -349,6 +355,7 @@
                fname, initfunc));
     std::string file_name(fname);
     std::string init_func(initfunc);
+    m_listeners.module_.preLoad(file_name, init_func);
     try
       {
         if (init_func.empty())
@@ -358,6 +365,7 @@
           }
         std::string path(m_module->load(file_name, init_func));
         RTC_DEBUG(("module path: %s", path.c_str()));
+        m_listeners.module_.postLoad(path, init_func);
       }
     catch (...)
       {
@@ -376,7 +384,10 @@
   void Manager::unload(const char* fname)
   {
     RTC_TRACE(("Manager::unload()"));
+    std::string fnamestr(fname);
+    m_listeners.module_.preUnload(fnamestr);
     m_module->unload(fname);
+    m_listeners.module_.postUnload(fnamestr);
     return;
   }
   
@@ -520,10 +531,12 @@
   RTObject_impl* Manager::createComponent(const char* comp_args)
   {
     RTC_TRACE(("Manager::createComponent(%s)", comp_args));
+    std::string argstr(comp_args);
+    m_listeners.rtclifecycle_.preCreate(argstr);
     //------------------------------------------------------------
     // extract "comp_type" and "comp_prop" from comp_arg
     coil::Properties comp_prop, comp_id;
-    if (!procComponentArgs(comp_args, comp_id, comp_prop)) return NULL;
+    if (!procComponentArgs(argstr.c_str(), comp_id, comp_prop)) return NULL;
 
     //------------------------------------------------------------
     // Because the format of port-name had been changed from <port_name> 
@@ -637,7 +650,7 @@
 	return NULL;
       }
     RTC_TRACE(("RTC created: %s", comp_id["implementation_id"].c_str()));
-
+    m_listeners.rtclifecycle_.postCreate(comp);
     prop << comp_prop;
 
     //------------------------------------------------------------
@@ -646,12 +659,14 @@
     // rtc.conf:
     //   [category].[type_name].config_file = file_name
     //   [category].[instance_name].config_file = file_name
+    m_listeners.rtclifecycle_.preConfigure(prop);
     configureComponent(comp, prop);
-
+    m_listeners.rtclifecycle_.postConfigure(prop);
     // comp->setProperties(prop);
     
     //------------------------------------------------------------
     // Component initialization
+    m_listeners.rtclifecycle_.preInitialize();
     if (comp->initialize() != RTC::RTC_OK)
       {
 	RTC_TRACE(("RTC initialization failed: %s",
@@ -662,6 +677,7 @@
       }
     RTC_TRACE(("RTC initialization succeeded: %s",
                comp_id["implementation_id"].c_str()));
+    m_listeners.rtclifecycle_.postInitialize();
     //------------------------------------------------------------
     // Bind component to naming service
     registerComponent(comp);
@@ -681,13 +697,16 @@
     // ### NamingManager のみで代用可能
     m_compManager.registerObject(comp);
     
-    std::vector<std::string> names(comp->getNamingNames());
+    coil::vstring names(comp->getNamingNames());
     
+    m_listeners.naming_.preBind(comp, names);
     for (int i(0), len(names.size()); i < len; ++i)
       {
 	RTC_TRACE(("Bind name: %s", names[i].c_str()));
 	m_namingManager->bindObject(names[i].c_str(), comp);
       }
+    m_listeners.naming_.postBind(comp, names);
+
     return true;
   }
   
@@ -704,13 +723,15 @@
     // ### NamingManager のみで代用可能
     m_compManager.unregisterObject(comp->getInstanceName());
     
-    std::vector<std::string> names(comp->getNamingNames());
-    
+    coil::vstring names(comp->getNamingNames());
+
+    m_listeners.naming_.preUnbind(comp, names);
     for (int i(0), len(names.size()); i < len; ++i)
       {
 	RTC_TRACE(("Unbind name: %s", names[i].c_str()));
 	m_namingManager->unbindObject(names[i].c_str());
       }
+    m_listeners.naming_.postUnbind(comp, names);
 
     return true;
   }
@@ -818,7 +839,70 @@
     RTC_TRACE(("Manager::getComponents()"));
     return m_compManager.getObjects();
   }
+
+  void Manager::
+  addManagerActionListener(RTM::ManagerActionListener* listener,
+                           bool autoclean)
+  {
+    m_listeners.manager_.addListener(listener, autoclean);
+  }
+  void Manager::
+  removeManagerActionListener(RTM::ManagerActionListener* listener)
+  {
+    m_listeners.manager_.removeListener(listener);
+  }
   
+  void Manager::
+  addModuleActionListener(RTM::ModuleActionListener* listener,
+                           bool autoclean)
+  {
+    m_listeners.module_.addListener(listener, autoclean);
+  }
+  void Manager::
+  removeModuleActionListener(RTM::ModuleActionListener* listener)
+  {
+    m_listeners.module_.removeListener(listener);
+  }
+
+  void Manager::
+  addRtcLifecycleActionListener(RTM::RtcLifecycleActionListener* listener,
+                                bool autoclean)
+  {
+    m_listeners.rtclifecycle_.addListener(listener, autoclean);
+  }
+  void Manager::
+  removeRtcLifecycleActionListener(RTM::RtcLifecycleActionListener* listener)
+  {
+    m_listeners.rtclifecycle_.removeListener(listener);
+  }
+  
+  void Manager::
+  addNamingActionListener(RTM::NamingActionListener* listener,
+                          bool autoclean)
+  {
+    m_listeners.naming_.addListener(listener, autoclean);
+  }
+
+  void Manager::
+  removeNamingActionListener(RTM::NamingActionListener* listener)
+  {
+    m_listeners.naming_.removeListener(listener);
+  }
+  
+  void Manager::
+  addLocalServiceActionListener(RTM::LocalServiceActionListener* listener,
+                                bool autoclean)
+  {
+    m_listeners.localservice_.addListener(listener, autoclean);
+  }
+
+  void Manager::
+  removeLocalServiceActionListener(RTM::LocalServiceActionListener* listener)
+  {
+    m_listeners.localservice_.removeListener(listener);
+  }
+
+  
   //============================================================
   // CORBA 関連
   //============================================================
@@ -1375,6 +1459,19 @@
   void Manager::shutdownNaming()
   {
     RTC_TRACE(("Manager::shutdownNaming()"));
+    std::vector<RTObject_impl*> comps = getComponents();
+
+    for (size_t i(0); i < comps.size(); ++i)
+      {
+        coil::vstring names = comps[i]->getNamingNames();
+        m_listeners.naming_.preUnbind(comps[i], names);
+        for (size_t j(0); j < names.size(); ++j)
+          {
+            m_namingManager->unbindObject(names[j].c_str());
+          }
+        m_listeners.naming_.postUnbind(comps[i], names);
+      }
+
     m_namingManager->unbindAll();
     delete m_namingManager;
   }
@@ -1473,6 +1570,25 @@
     return true;
   }
   
+  bool Manager::initLocalService()
+  {
+    RTC_TRACE(("Manager::initLocalService()"));
+
+    RTM::LocalServiceAdmin& admin = RTM::LocalServiceAdmin::instance();
+    coil::Properties& prop(m_config.getNode("manager.local_service"));
+    admin.init(prop);
+    RTC_DEBUG(("LocalServiceAdmin's properties:"));
+    RTC_DEBUG_STR((prop));
+
+    RTM::LocalServiceProfileList svclist = admin.getServiceProfiles();
+    for (size_t i(0); i < svclist.size(); ++i)
+      {
+        RTC_INFO(("Available local service: %s (%s)",
+        svclist[i].name.c_str(), svclist[i].uuid.c_str()));
+      }
+    return true;
+  }
+
   /*!
    * @if jp
    * @brief NamingManager の終了処理

Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.h	2011-08-23 22:31:13 UTC (rev 2219)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -34,6 +34,7 @@
 #include <rtm/ECFactory.h>
 #include <rtm/ObjectManager.h>
 #include <rtm/SystemLogger.h>
+#include <rtm/ManagerActionListener.h>
 
 namespace RTM
 {
@@ -874,7 +875,39 @@
      * @endif
      */
     std::vector<RTObject_impl*> getComponents();
+
+
+    void
+    addManagerActionListener(RTM::ManagerActionListener* listener,
+                             bool autoclean = true);
+    void
+    removeManagerActionListener(RTM::ManagerActionListener* listener);
+
+    void
+    addModuleActionListener(RTM::ModuleActionListener* listener,
+                             bool autoclean = true);
+    void
+    removeModuleActionListener(RTM::ModuleActionListener* listener);
+
+    void
+    addRtcLifecycleActionListener(RTM::RtcLifecycleActionListener* listener,
+                                  bool autoclean = true);
+    void
+    removeRtcLifecycleActionListener(RTM::RtcLifecycleActionListener* listener);
     
+    void
+    addNamingActionListener(RTM::NamingActionListener* listener,
+                            bool autoclean = true);
+    void
+    removeNamingActionListener(RTM::NamingActionListener* listener);
+    
+    void
+    addLocalServiceActionListener(RTM::LocalServiceActionListener* listener,
+                                       bool autoclean = true);
+    void
+    removeLocalServiceActionListener(RTM::LocalServiceActionListener* listener);
+
+    
     //============================================================
     // CORBA 関連
     //============================================================
@@ -1442,6 +1475,21 @@
 
     /*!
      * @if jp
+     * @brief LocalService の初期化
+     *
+     * @return Timer 初期化処理実行結果(初期化成功:true、初期化失敗:false)
+     *
+     * @else
+     * @brief LocalService initialization
+     *
+     * @return Timer Initialization result (Successful:true, Failed:false)
+     *
+     * @endif
+     */
+    bool initLocalService();
+
+    /*!
+     * @if jp
      * @brief ManagerServant へのポインタ
      * @else
      * @brief The pointer to the ManagerServant
@@ -1957,7 +2005,7 @@
      * @endif
      */
     OrbRunner* m_runner;
-    
+
     //------------------------------------------------------------
     // Manager Terminator
     //------------------------------------------------------------
@@ -2109,7 +2157,7 @@
     };
     Finalized m_finalized;
 
-
+    ::RTM::ManagerActionListeners m_listeners;
   }; // class Manager
 }; // namespace RTC
 

Added: trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.cpp	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.cpp	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,523 @@
+// -*- C++ -*-
+/*!
+ * @file ManagerActionListener.cpp
+ * @brief Component action listener class
+ * @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 <rtm/ManagerActionListener.h>
+
+namespace RTM
+{
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class ManagerActionListener クラス
+   * @else
+   * @class ManagerActionListener class
+   * @endif
+   */
+  ManagerActionListener::~ManagerActionListener()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @class ManagerActionListenerHolder クラス
+   * @else
+   * @class ManagerActionListenerHolder class
+   * @endif
+   */
+  ManagerActionListenerHolder::~ManagerActionListenerHolder()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief preShutdown コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preShutdown callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ManagerActionListenerHolder::preShutdown()
+  {
+    LISTENERHOLDER_CALLBACK(preShutdown, ());
+  }
+  
+  /*!
+   * @if jp
+   * @brief postShutdown コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postShutdown callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ManagerActionListenerHolder::postShutdown()
+  {
+    LISTENERHOLDER_CALLBACK(postShutdown, ());
+  }
+  
+  /*!
+   * @if jp
+   * @brief preReinit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preReinit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ManagerActionListenerHolder::preReinit()
+  {
+    LISTENERHOLDER_CALLBACK(preReinit, ());
+  }
+  
+  /*!
+   * @if jp
+   * @brief postReinit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postReinit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ManagerActionListenerHolder::postReinit()
+  {
+    LISTENERHOLDER_CALLBACK(postReinit, ());
+  }
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class ModuleActionListener クラス
+   * @else
+   * @class ModuleActionListener class
+   * @endif
+   */
+  ModuleActionListener::~ModuleActionListener()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @class ModuleActionListener ホルダクラス
+   * @else
+   * @class ModuleActionListener holder class
+   * @endif
+   */
+  ModuleActionListenerHolder::~ModuleActionListenerHolder()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief preLoad コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preLoad callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ModuleActionListenerHolder::preLoad(std::string& modname,
+                                           std::string& funcname)
+  {
+    LISTENERHOLDER_CALLBACK(preLoad, (modname, funcname));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postLoad コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postLoad callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ModuleActionListenerHolder::postLoad(std::string& modname,
+                                            std::string& funcname)
+  {
+    LISTENERHOLDER_CALLBACK(postLoad, (modname, funcname));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preUnload コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preUnload callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ModuleActionListenerHolder::preUnload(std::string& modname)
+  {
+    LISTENERHOLDER_CALLBACK(preUnload, (modname));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postUnload コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postUnload callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void ModuleActionListenerHolder::postUnload(std::string& modname)
+  {
+    LISTENERHOLDER_CALLBACK(postUnload, (modname));
+  }
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class RtcLifecycleActionListener クラス
+   * @brief RtcLifecycleActionListener クラス
+   * @else
+   * @class RtcLifecycleActionListener class
+   * @brief RtcLifecycleActionListener class
+   * @endif
+   */
+  RtcLifecycleActionListener::~RtcLifecycleActionListener()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief デストラクタ
+   * @else
+   * @brief Destructor
+   * @endif
+   */
+  RtcLifecycleActionListenerHolder::~RtcLifecycleActionListenerHolder()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief preCreate コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preCreate callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::preCreate(std::string& args)
+  {
+    LISTENERHOLDER_CALLBACK(preCreate, (args));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postCreate コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postCreate callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::postCreate(RTC::RTObject_impl* rtobj)
+  {
+    LISTENERHOLDER_CALLBACK(postCreate, (rtobj));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preConfigure コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preConfigure callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::preConfigure(coil::Properties& prop)
+  {
+    LISTENERHOLDER_CALLBACK(preConfigure, (prop));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postConfigure コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postConfigure callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::postConfigure(coil::Properties& prop)
+  {
+    LISTENERHOLDER_CALLBACK(postConfigure, (prop));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preInitialize コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preInitialize callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::preInitialize(void)
+  {
+    LISTENERHOLDER_CALLBACK(preInitialize, ());
+  }
+  
+  /*!
+   * @if jp
+   * @brief postInitialize コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postInitialize callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void RtcLifecycleActionListenerHolder::postInitialize(void)
+  {
+    LISTENERHOLDER_CALLBACK(postInitialize, ());
+  }
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @brief デストラクタ
+   * @else
+   * @brief Destructor
+   * @endif
+   */
+  NamingActionListener::~NamingActionListener()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief デストラクタ
+   * @else
+   * @brief Destructor
+   * @endif
+   */
+  NamingActionListenerHolder::~NamingActionListenerHolder()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief preBind コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preBind callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void NamingActionListenerHolder::preBind(RTC::RTObject_impl* rtobj,
+                                           coil::vstring& name)
+  {
+    LISTENERHOLDER_CALLBACK(preBind, (rtobj, name));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postBind コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postBind callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void NamingActionListenerHolder::postBind(RTC::RTObject_impl* rtobj,
+                                            coil::vstring& name)
+  {
+    LISTENERHOLDER_CALLBACK(postBind, (rtobj, name));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preUnbind コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preUnbind callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void NamingActionListenerHolder::preUnbind(RTC::RTObject_impl* rtobj,
+                                             coil::vstring& name)
+  {
+    LISTENERHOLDER_CALLBACK(preUnbind, (rtobj, name));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postUnbind コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postUnbind callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void NamingActionListenerHolder::postUnbind(RTC::RTObject_impl* rtobj,
+                                              coil::vstring& name)
+  {
+    LISTENERHOLDER_CALLBACK(postUnbind, (rtobj, name));
+  }
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @brief デストラクタ
+   * @else
+   * @brief Destructor
+   * @endif
+   */
+  LocalServiceActionListener::~LocalServiceActionListener()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief デストラクタ
+   * @else
+   * @brief Destructor
+   * @endif
+   */
+  LocalServiceActionListenerHolder::~LocalServiceActionListenerHolder()
+  {
+  }
+  
+  /*!
+   * @if jp
+   * @brief preServiceRegister コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preServiceRegister callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  preServiceRegister(std::string service_name)
+  {
+    LISTENERHOLDER_CALLBACK(preServiceRegister, (service_name));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postServiceRegister コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postServiceRegister callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  postServiceRegister(std::string service_name, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(postServiceRegister, (service_name, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preServiceInit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preServiceInit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  preServiceInit(coil::Properties& prop, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(preServiceInit, (prop, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postServiceInit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postServiceInit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  postServiceInit(coil::Properties& prop, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(postServiceInit, (prop, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preServiceReinit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preServiceReinit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  preServiceReinit(coil::Properties& prop, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(preServiceReinit, (prop, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postServiceReinit コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postServiceReinit callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  postServiceReinit(coil::Properties& prop, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(postServiceReinit, (prop, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief postServiceFinalize コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief postServiceFinalize callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  postServiceFinalize(std::string service_name, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(postServiceFinalize, (service_name, service));
+  }
+  
+  /*!
+   * @if jp
+   * @brief preServiceFinalize コールバック関数
+   * TODO: Documentation
+   * @else
+   * @brief preServiceFinalize callback function
+   * TODO: Documentation
+   * @endif
+   */
+  void LocalServiceActionListenerHolder::
+  preServiceFinalize(std::string service_name, RTM::LocalServiceBase* service)
+  {
+    LISTENERHOLDER_CALLBACK(preServiceFinalize, (service_name, service));
+  }
+  
+};


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.cpp
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain

Added: trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.h	                        (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.h	2011-08-24 15:35:53 UTC (rev 2220)
@@ -0,0 +1,976 @@
+// -*- C++ -*-
+/*!
+ * @file ManagerActionListener.h
+ * @brief component action listener class
+ * @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$
+ *
+ */
+
+#ifndef RTM_MANAGERACTIONLISTENER_H
+#define RTM_MANAGERACTIONLISTENER_H
+
+#include <vector>
+#include <utility>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
+#include <coil/Properties.h>
+#include <coil/stringutil.h>
+#include <rtm/ListenerHolder.h>
+
+// forward decl
+namespace RTC
+{
+  class RTObject_impl;
+};
+
+namespace RTM
+{
+  // forward decl
+  class LocalServiceBase;
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class ManagerActionListener
+   *
+   * - マネージャShutdownの直前: void onPreShutdown()
+   * - マネージャShutdownの直後: void onPostShutdown()
+   * - マネージャの再初期化直前: void onPreReinit()
+   * - マネージャの再初期化直後: void onPostReinit()
+   *
+   * TODO: Documentation
+   *
+   * @else
+   * @class ManagerActionListener
+   *
+   * TODO: Documentation
+   *
+   * @endif
+   */
+  class ManagerActionListener
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief ManagerActinListener dtor
+     * TODO: Documentation
+     * @else
+     * @brief ManagerActionListener dtor
+     * TODO: Documentation
+     * @endif
+     */
+    virtual ~ManagerActionListener();
+
+    /*!
+     * @if jp
+     * @brief preShutdown コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preShutdown callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preShutdown() = 0;
+
+    /*!
+     * @if jp
+     * @brief postShutdown コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postShutdown callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postShutdown() = 0;
+
+    /*!
+     * @if jp
+     * @brief preReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preReinit() = 0;
+
+    /*!
+     * @if jp
+     * @brief postReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postReinit() = 0;
+  };
+  
+  
+  /*!
+   * @if jp
+   * @class ManagerActionListenerHolder クラス
+   * @else
+   * @class ManagerActionListenerHolder class
+   * @endif
+   */
+  class ManagerActionListenerHolder
+    : public ::RTM::util::ListenerHolder<ManagerActionListener>
+  {
+  public:
+    virtual ~ManagerActionListenerHolder();
+
+    /*!
+     * @if jp
+     * @brief preShutdown コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preShutdown callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preShutdown();
+
+    /*!
+     * @if jp
+     * @brief postShutdown コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postShutdown callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postShutdown();
+
+    /*!
+     * @if jp
+     * @brief preReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preReinit();
+
+    /*!
+     * @if jp
+     * @brief postReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postReinit();
+  };
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class ModuleActionListener クラス
+   * @brief ModuleActionListener クラス
+   *
+   * @else
+   * @class ModuleActionListener class
+   * @brief ModuleActionListener class
+   *
+   * @endif
+   */
+  class ModuleActionListener
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~ModuleActionListener();
+    
+    /*!
+     * @if jp
+     * @brief preLoad コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preLoad callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preLoad(std::string& modname,
+                         std::string& funcname) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postLoad コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postLoad callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postLoad(std::string& modname,
+                          std::string& funcname) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preUnload コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preUnload callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preUnload(std::string& modname) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postUnload コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postUnload callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postUnload(std::string& modname) = 0;
+  };
+  
+  
+  /*!
+   * @if jp
+   * @class ModuleActionListenerHolder クラス
+   * @brief ModuleActionListenerHolder クラス
+   *
+   * @else
+   * @class ModuleActionListenerHolder class
+   * @brief ModuleActionListenerHolder class
+   *
+   * @endif
+   */
+  class ModuleActionListenerHolder
+    : public ::RTM::util::ListenerHolder<ModuleActionListener>
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~ModuleActionListenerHolder();
+    
+    /*!
+     * @if jp
+     * @brief preLoad コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preLoad callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preLoad(std::string& modname,
+                         std::string& funcname);
+    
+    /*!
+     * @if jp
+     * @brief postLoad コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postLoad callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postLoad(std::string& modname,
+                          std::string& funcname);
+    
+    /*!
+     * @if jp
+     * @brief preUnload コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preUnload callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preUnload(std::string& modname);
+    
+    /*!
+     * @if jp
+     * @brief postUnload コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postUnload callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postUnload(std::string& modname);
+  };
+  
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class RtcLifecycleActionListener クラス
+   * @brief RtcLifecycleActionListener クラス
+   *
+   * RTC系
+   * - RTC生成の直前 bool (std::string&)
+   *   void preCreate(std::string& args) = 0;
+   * - RTC生成の直後 bool (RTObject_impl*)
+   *   void postCreate(RTObject_impl*) = 0;
+   * - RTCのコンフィグ直前 bool (coil::Properties& prop)
+   *   void preConfigure(coil::Properties& prop) = 0;
+   * - RTCのコンフィグ直後 bool (coil::Properties& prop)
+   *   void postConfigure(coil::Properties& prop) = 0;
+   * - RTCの初期化の直前 bool (void)
+   *   void preInitialize(void) = 0;
+   * - RTCの初期化の直後 bool (void)
+   *   void postInitialize(void) = 0;
+   *
+   * @else
+   * @class RtcLifecycleActionListener class
+   * @brief RtcLifecycleActionListener class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class RtcLifecycleActionListener
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~RtcLifecycleActionListener();
+    
+    /*!
+     * @if jp
+     * @brief preCreate コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preCreate callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preCreate(std::string& args) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postCreate コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postCreate callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postCreate(RTC::RTObject_impl*) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preConfigure コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preConfigure callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preConfigure(coil::Properties& prop) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postConfigure コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postConfigure callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postConfigure(coil::Properties& prop) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preInitialize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preInitialize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preInitialize(void) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postInitialize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postInitialize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postInitialize(void) = 0;
+  };
+  
+  
+  /*!
+   * @if jp
+   * @class RtcLifecycleActionListenerHolder クラス
+   * @brief RtcLifecycleActionListenerHolder クラス
+   *
+   * @else
+   * @class RtcLifecycleActionListenerHolder class
+   * @brief RtcLifecycleActionListenerHolder class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class RtcLifecycleActionListenerHolder
+    : public RTM::util::ListenerHolder<RtcLifecycleActionListener>
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~RtcLifecycleActionListenerHolder();
+    
+    
+    /*!
+     * @if jp
+     * @brief preCreate コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preCreate callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preCreate(std::string& args);
+    
+    /*!
+     * @if jp
+     * @brief postCreate コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postCreate callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postCreate(RTC::RTObject_impl* rtobj);
+    
+    /*!
+     * @if jp
+     * @brief preConfigure コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preConfigure callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preConfigure(coil::Properties& prop);
+    
+    /*!
+     * @if jp
+     * @brief postConfigure コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postConfigure callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postConfigure(coil::Properties& prop);
+    
+    /*!
+     * @if jp
+     * @brief preInitialize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preInitialize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preInitialize(void);
+    
+    /*!
+     * @if jp
+     * @brief postInitialize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postInitialize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postInitialize(void);
+  };
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class NamingActionListener クラス
+   * @brief NamingActionListener クラス
+   *
+   * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+   * でコールされるリスなクラスの基底クラス。
+   *
+   * Registration系
+   * - PRE_NS_REGISTER:    RTCの名前の登録の直前 bool (coil::vstring&)
+   * - POST_NS_REGISTER:   RTCの名前の登録の直後 bool (coil::vstring&)
+   * - PRE_NS_UNREGISTER:  RTCの名前の登録の直前 bool (coil::vstring&)
+   * - POST_NS_UNREGISTER: RTCの名前の登録の直後 bool (coil::vstring&)
+   *
+   * - ADD_PORT:
+   * - REMOVE_PORT:
+   *
+   * @else
+   * @class NamingActionListener class
+   * @brief NamingActionListener class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class NamingActionListener
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~NamingActionListener();
+    
+    /*!
+     * @if jp
+     * @brief preBind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preBind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preBind(RTC::RTObject_impl* rtobj,
+                         coil::vstring& name) = 0;
+    /*!
+     * @if jp
+     * @brief postBind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postBind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postBind(RTC::RTObject_impl* rtobj,
+                          coil::vstring& name) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preUnbind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preUnbind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preUnbind(RTC::RTObject_impl* rtobj,
+                           coil::vstring& name) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postUnbind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postUnbind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postUnbind(RTC::RTObject_impl* rtobj,
+                            coil::vstring& name) = 0;
+  };
+  
+  
+  /*!
+   * @if jp
+   * @class NamingActionListenerHolder クラス
+   * @brief NamingActionListenerHolder クラス
+   *
+   * @else
+   * @class NamingActionListenerHolder class
+   * @brief NamingActionListenerHolder class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class NamingActionListenerHolder
+    : public RTM::util::ListenerHolder<NamingActionListener>
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~NamingActionListenerHolder();
+    
+    /*!
+     * @if jp
+     * @brief preBind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preBind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preBind(RTC::RTObject_impl* rtobj,
+                         coil::vstring& name);
+    /*!
+     * @if jp
+     * @brief postBind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postBind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postBind(RTC::RTObject_impl* rtobj,
+                          coil::vstring& name);
+    
+    /*!
+     * @if jp
+     * @brief preUnbind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preUnbind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preUnbind(RTC::RTObject_impl* rtobj,
+                           coil::vstring& name);
+    
+    /*!
+     * @if jp
+     * @brief postUnbind コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postUnbind callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postUnbind(RTC::RTObject_impl* rtobj,
+                            coil::vstring& name);
+  };
+  
+  
+  //============================================================
+  /*!
+   * @if jp
+   * @class LocalServiceActionListener クラス
+   * @brief LocalServiceActionListener クラス
+   *
+   * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+   * でコールされるリスなクラスの基底クラス。
+   *
+   * - ADD_PORT:
+   * - REMOVE_PORT:
+   *
+   * @else
+   * @class LocalServiceActionListener class
+   * @brief LocalServiceActionListener class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class LocalServiceActionListener
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~LocalServiceActionListener();
+    
+    /*!
+     * @if jp
+     * @brief preServiceRegister コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceRegister callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceRegister(std::string service_name) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postServiceRegister コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceRegister callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceRegister(std::string service_name,
+                                     RTM::LocalServiceBase* service) = 0;
+
+    /*!
+     * @if jp
+     * @brief preServiceInit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceInit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceInit(coil::Properties& prop,
+                                RTM::LocalServiceBase* service) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postServiceInit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceInit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceInit(coil::Properties& prop,
+                                 RTM::LocalServiceBase* service) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preServiceReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceReinit(coil::Properties& prop,
+                                  RTM::LocalServiceBase* service) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postServiceReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceReinit(coil::Properties& prop,
+                                   RTM::LocalServiceBase* service) = 0;
+    
+    /*!
+     * @if jp
+     * @brief postServiceFinalize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceFinalize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceFinalize(std::string service_name,
+                                     RTM::LocalServiceBase* service) = 0;
+    
+    /*!
+     * @if jp
+     * @brief preServiceFinalize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceFinalize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceFinalize(std::string service_name,
+                                    RTM::LocalServiceBase* service) = 0;
+  };
+  
+  
+  /*!
+   * @if jp
+   * @class LocalServiceActionListenerHolder クラス
+   * @brief LocalServiceActionListenerHolder クラス
+   *
+   * 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
+   * でコールされるリスなクラスの基底クラス。
+   *
+   * - ADD_PORT:
+   * - REMOVE_PORT:
+   *
+   * @else
+   * @class LocalServiceActionListenerHolder class
+   * @brief LocalServiceActionListenerHolder class
+   *
+   * This class is abstract base class for listener classes that
+   * provides callbacks for various events in rtobject.
+   *
+   * @endif
+   */
+  class LocalServiceActionListenerHolder
+    : public RTM::util::ListenerHolder<LocalServiceActionListener>
+  {
+  public:
+    /*!
+     * @if jp
+     * @brief デストラクタ
+     * @else
+     * @brief Destructor
+     * @endif
+     */
+    virtual ~LocalServiceActionListenerHolder();
+    
+    // registration instance of service to svc admin
+    /*!
+     * @if jp
+     * @brief preServiceRegister コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceRegister callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceRegister(std::string service_name);
+    
+    /*!
+     * @if jp
+     * @brief postServiceRegister コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceRegister callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceRegister(std::string service_name,
+                                     RTM::LocalServiceBase* service);
+    
+    /*!
+     * @if jp
+     * @brief preServiceInit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceInit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceInit(coil::Properties& prop,
+                                RTM::LocalServiceBase* service);
+    /*!
+     * @if jp
+     * @brief postServiceInit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceInit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceInit(coil::Properties& prop,
+                                 RTM::LocalServiceBase* service);
+    
+    /*!
+     * @if jp
+     * @brief preServiceReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceReinit(coil::Properties& prop,
+                                  RTM::LocalServiceBase* service);
+    /*!
+     * @if jp
+     * @brief postServiceReinit コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceReinit callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceReinit(coil::Properties& prop,
+                                   RTM::LocalServiceBase* service);
+
+    /*!
+     * @if jp
+     * @brief postServiceFinalize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief postServiceFinalize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void postServiceFinalize(std::string service_name,
+                                     RTM::LocalServiceBase* service);
+    /*!
+     * @if jp
+     * @brief preServiceFinalize コールバック関数
+     * TODO: Documentation
+     * @else
+     * @brief preServiceFinalize callback function
+     * TODO: Documentation
+     * @endif
+     */
+    virtual void preServiceFinalize(std::string service_name,
+                                    RTM::LocalServiceBase* service);
+  };
+  
+  
+  
+  /*!
+   * @if jp
+   * @class ManagerActionListeners
+   * @brief ManagerActionListeners クラス
+   *
+   *
+   * @else
+   * @class ManagerActionListeners
+   * @brief ManagerActionListeners class
+   *
+   *
+   * @endif
+   */
+  class ManagerActionListeners
+  {
+  public:
+    ManagerActionListenerHolder manager_;
+    ModuleActionListenerHolder module_;
+    RtcLifecycleActionListenerHolder rtclifecycle_;
+    NamingActionListenerHolder naming_;
+    LocalServiceActionListenerHolder localservice_;
+  };
+}; // namespace RTM
+
+#endif // RTC_MANAGERACTIONLISTENER_H


Property changes on: trunk/OpenRTM-aist/src/lib/rtm/ManagerActionListener.h
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain



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