[openrtm-commit:00181] r412 - in branches/RELENG_1_0/OpenRTM-aist-Python: . OpenRTM_aist OpenRTM_aist/test OpenRTM_aist/utils/rtc-template OpenRTM_aist/utils/rtm-naming
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 6月 16日 (木) 15:01:10 JST
Author: kurihara
Date: 2011-06-16 15:01:09 +0900 (Thu, 16 Jun 2011)
New Revision: 412
Removed:
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ComponentActionListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortConnectListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ComponentActionListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConfigurationListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_PortConnectListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_SdoServiceAdmin.py
Modified:
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/NVUtil.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoConfiguration.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConnectorListener.py
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/utils/rtc-template/
branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/utils/rtm-naming/
branches/RELENG_1_0/OpenRTM-aist-Python/setup.py
Log:
Returned a change of r396:404 to r395.
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ComponentActionListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ComponentActionListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ComponentActionListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,1140 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file ComponentActionListener.py
-# @brief component action listener class
-# @date $Date$
-# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-
-#============================================================
-
-##
-# @if jp
-# @brief PreComponentActionListener のタイプ
-#
-# - PRE_ON_INITIALIZE: onInitialize 直前
-# - PRE_ON_FINALIZE: onFinalize 直前
-# - PRE_ON_STARTUP: onStartup 直前
-# - PRE_ON_SHUTDOWN: onShutdown 直前
-# - PRE_ON_ACTIVATED: onActivated 直前
-# - PRE_ON_DEACTIVATED: onDeactivated 直前
-# - PRE_ON_ABORTING: onAborted 直前
-# - PRE_ON_ERROR: onError 直前
-# - PRE_ON_RESET: onReset 直前
-# - PRE_ON_EXECUTE: onExecute 直前
-# - PRE_ON_STATE_UPDATE: onStateUpdate 直前
-# - PRE_ON_RATE_CHANGED: onRateChanged 直前
-#
-# @else
-# @brief The types of ConnectorDataListener
-#
-# @endif
-class PreComponentActionListenerType:
- """
- """
-
- def __init__(self):
- pass
-
- PRE_ON_INITIALIZE = 0
- PRE_ON_FINALIZE = 1
- PRE_ON_STARTUP = 2
- PRE_ON_SHUTDOWN = 3
- PRE_ON_ACTIVATED = 4
- PRE_ON_DEACTIVATED = 5
- PRE_ON_ABORTING = 6
- PRE_ON_ERROR = 7
- PRE_ON_RESET = 8
- PRE_ON_EXECUTE = 9
- PRE_ON_STATE_UPDATE = 10
- PRE_ON_RATE_CHANGED = 11
- PRE_COMPONENT_ACTION_LISTENER_NUM = 12
-
-
-##
-# @if jp
-# @class PreComponentActionListener クラス
-# @brief PreComponentActionListener クラス
-#
-# OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
-# て、
-#
-# - on_initialize()
-# - on_finalize()
-# - on_startup()
-# - on_shutdown()
-# - on_activated
-# - on_deactivated()
-# - on_aborted()
-# - on_error()
-# - on_reset()
-# - on_execute()
-# - on_state_update()
-# - on_rate_changed()
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスナクラスの基底クラス。
-#
-# - PRE_ON_INITIALIZE:
-# - PRE_ON_FINALIZE:
-# - PRE_ON_STARTUP:
-# - PRE_ON_SHUTDOWN:
-# - PRE_ON_ACTIVATED:
-# - PRE_ON_DEACTIVATED:
-# - PRE_ON_ABORTING:
-# - PRE_ON_ERROR:
-# - PRE_ON_RESET:
-# - PRE_IN_EXECUTE:
-# - PRE_ON_STATE_UPDATE:
-# - PRE_ON_RATE_CHANGED:
-#
-# @else
-# @class PreComponentActionListener class
-# @brief PreComponentActionListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# @endif
-class PreComponentActionListener:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief PreComponentActionListenerType を文字列に変換
- #
- # PreComponentActionListenerType を文字列に変換する
- #
- # @param type 変換対象 PreComponentActionListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert PreComponentActionListenerType into the string.
- #
- # Convert PreComponentActionListenerType into the string.
- #
- # @param type The target PreComponentActionListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- # static const char* toString(PreComponentActionListenerType type)
- def toString(type):
- typeString = ["PRE_ON_INITIALIZE",
- "PRE_ON_FINALIZE",
- "PRE_ON_STARTUP",
- "PRE_ON_SHUTDOWN",
- "PRE_ON_ACTIVATED",
- "PRE_ON_DEACTIVATED",
- "PRE_ON_ABORTING",
- "PRE_ON_ERROR",
- "PRE_ON_RESET",
- "PRE_ON_EXECUTE",
- "PRE_ON_STATE_UPDATE",
- "PRE_ON_RATE_CHANGED",
- "PRE_COMPONENT_ACTION_LISTENER_NUM"]
- if type < PreComponentActionListenerType.PRE_COMPONENT_ACTION_LISTENER_NUM:
- return typeString[type]
-
- return ""
- toString = staticmethod(toString)
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # PreComponentActionListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for PreComponentActionListener.
- #
- # @endif
- # virtual void operator()(UniqueId ec_id) = 0;
- def __call__(self, ec_id):
- pass
-
-
-#============================================================
-
-##
-# @if jp
-# @brief PostCompoenntActionListener のタイプ
-#
-# - POST_ON_INITIALIZE:
-# - POST_ON_FINALIZE:
-# - POST_ON_STARTUP:
-# - POST_ON_SHUTDOWN:
-# - POST_ON_ACTIVATED:
-# - POST_ON_DEACTIVATED:
-# - POST_ON_ABORTING:
-# - POST_ON_ERROR:
-# - POST_ON_RESET:
-# - POST_ON_EXECUTE:
-# - POST_ON_STATE_UPDATE:
-# - POST_ON_RATE_CHANGED:
-#
-# @else
-# @brief The types of ConnectorDataListener
-#
-# @endif
-class PostComponentActionListenerType:
- """
- """
- def __init__(self):
- pass
-
- POST_ON_INITIALIZE = 0
- POST_ON_FINALIZE = 1
- POST_ON_STARTUP = 2
- POST_ON_SHUTDOWN = 3
- POST_ON_ACTIVATED = 4
- POST_ON_DEACTIVATED = 5
- POST_ON_ABORTING = 6
- POST_ON_ERROR = 7
- POST_ON_RESET = 8
- POST_ON_EXECUTE = 9
- POST_ON_STATE_UPDATE = 10
- POST_ON_RATE_CHANGED = 11
- POST_COMPONENT_ACTION_LISTENER_NUM = 12
-
-
-
-##
-# @if jp
-# @class PostComponentActionListener クラス
-# @brief PostComponentActionListener クラス
-#
-# OMG RTC仕様で定義されている以下のコンポーネントアクショントについ
-# て、
-#
-# - on_initialize()
-# - on_finalize()
-# - on_startup()
-# - on_shutdown()
-# - on_activated
-# - on_deactivated()
-# - on_aborted()
-# - on_error()
-# - on_reset()
-# - on_execute()
-# - on_state_update()
-# - on_rate_changed()
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスなクラスの基底クラス。
-#
-# - POST_ON_INITIALIZE:
-# - POST_ON_FINALIZE:
-# - POST_ON_STARTUP:
-# - POST_ON_SHUTDOWN:
-# - POST_ON_ACTIVATED:
-# - POST_ON_DEACTIVATED:
-# - POST_ON_ABORTING:
-# - POST_ON_ERROR:
-# - POST_ON_RESET:
-# - POST_ON_EXECUTE:
-# - POST_ON_STATE_UPDATE:
-# - POST_ON_RATE_CHANGED:
-#
-# @else
-# @class PostComponentActionListener class
-# @brief PostComponentActionListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# @endif
-class PostComponentActionListener:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief PostComponentActionListenerType を文字列に変換
- #
- # PostComponentActionListenerType を文字列に変換する
- #
- # @param type 変換対象 PostComponentActionListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert PostComponentActionListenerType into the string.
- #
- # Convert PostComponentActionListenerType into the string.
- #
- # @param type The target PostComponentActionListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- # static const char* toString(PostComponentActionListenerType type)
- def toString(type):
- typeString = ["POST_ON_INITIALIZE",
- "POST_ON_FINALIZE",
- "POST_ON_STARTUP",
- "POST_ON_SHUTDOWN",
- "POST_ON_ACTIVATED",
- "POST_ON_DEACTIVATED",
- "POST_ON_ABORTING",
- "POST_ON_ERROR",
- "POST_ON_RESET",
- "POST_ON_EXECUTE",
- "POST_ON_STATE_UPDATE",
- "POST_ON_RATE_CHANGED",
- "POST_COMPONENT_ACTION_LISTENER_NUM"]
- if type < PostComponentActionListenerType.POST_COMPONENT_ACTION_LISTENER_NUM:
- return typeString[type]
- return "";
-
- toString = staticmethod(toString)
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # PostComponentActionListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for PostComponentActionListener.
- #
- # @endif
- #virtual void operator()(UniqueId ec_id,
- # ReturnCode_t ret) = 0;
- def __call__(self, ec_id, ret):
- pass
-
-
-
-#============================================================
-##
-# @if jp
-# @brief PortActionListener のタイプ
-#
-# - ADD_PORT: Port 追加時
-# - REMOVE_PORT: Port 削除時
-#
-# @else
-# @brief The types of PortActionListener
-#
-# @endif
-class PortActionListenerType:
- """
- """
-
- def __init__(self):
- pass
-
- ADD_PORT = 0
- REMOVE_PORT = 1
- PORT_ACTION_LISTENER_NUM = 2
-
-
-
-##
-# @if jp
-# @class PortActionListener クラス
-# @brief PortActionListener クラス
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスなクラスの基底クラス。
-#
-# - ADD_PORT:
-# - REMOVE_PORT:
-#
-# @else
-# @class PortActionListener class
-# @brief PortActionListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# @endif
-class PortActionListener:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief PortActionListenerType を文字列に変換
- #
- # PortActionListenerType を文字列に変換する
- #
- # @param type 変換対象 PortActionListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert PortActionListenerType into the string.
- #
- # Convert PortActionListenerType into the string.
- #
- # @param type The target PortActionListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- #static const char* toString(PortActionListenerType type)
- def toString(type):
- typeString = ["ADD_PORT",
- "REMOVE_PORT",
- "PORT_ACTION_LISTENER_NUM"]
- if type < PortActionListenerType.PORT_ACTION_LISTENER_NUM:
- return typeString[type]
- return ""
-
- toString = staticmethod(toString)
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- #virtual ~PortActionListener();
- def __del__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # PortActionListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for PortActionListener
- #
- # @endif
- #virtual void operator()(const ::RTC::PortProfile& pprof) = 0;
- def __call__(self, pprof):
- pass
-
-
-#============================================================
-##
-# @if jp
-# @brief ExecutionContextActionListener のタイプ
-#
-# - EC_ATTACHED: ExecutionContext 追加時
-# - EC_DETACHED: ExecutionContext 削除時
-#
-# @else
-# @brief The types of ExecutionContextActionListener
-#
-# @endif
-class ExecutionContextActionListenerType:
- """
- """
- def __init__(self):
- pass
-
- EC_ATTACHED = 0
- EC_DETACHED = 1
- EC_ACTION_LISTENER_NUM = 2
-
-##
-# @if jp
-# @class ExecutionContextActionListener クラス
-# @brief ExecutionContextActionListener クラス
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスなクラスの基底クラス。
-#
-# - ADD_PORT:
-# - REMOVE_PORT:
-#
-# @else
-# @class ExecutionContextActionListener class
-# @brief ExecutionContextActionListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# @endif
-class ExecutionContextActionListener:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief ExecutionContextActionListenerType を文字列に変換
- #
- # ExecutionContextActionListenerType を文字列に変換する
- #
- # @param type 変換対象 ExecutionContextActionListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert ExecutionContextActionListenerType into the string.
- #
- # Convert ExecutionContextActionListenerType into the string.
- #
- # @param type The target ExecutionContextActionListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- #static const char* toString(ExecutionContextActionListenerType type)
- def toString(type):
- typeString = ["ATTACH_EC",
- "DETACH_EC",
- "EC_ACTION_LISTENER_NUM"]
- if type < ExecutionContextActionListenerType.EC_ACTION_LISTENER_NUM:
- return typeString[type]
- return ""
-
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # ExecutionContextActionListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for ExecutionContextActionListener
- #
- # @endif
- #virtual void operator()(UniqueId ec_id) = 0;
- def __call__(self, ec_id):
- pass
-
-
-class Entry:
- def __init__(self,listener, autoclean):
- self.listener = listener
- self.autoclean = autoclean
- return
-
-
-#============================================================
-##
-# @if jp
-# @class PreComponentActionListenerHolder
-# @brief PreComponentActionListener ホルダクラス
-#
-# 複数の PreComponentActionListener を保持し管理するクラス。
-#
-# @else
-# @class PreComponentActionListenerHolder
-# @brief PreComponentActionListener holder class
-#
-# This class manages one ore more instances of
-# PreComponentActionListener class.
-#
-# @endif
-class PreComponentActionListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- return
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(PreComponentActionListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(PreComponentActionListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @endif
- #void notify(UniqueId ec_id);
- def notify(self, ec_id):
- for listener in self._listeners:
- listener.listener(ec_id)
- return
-
-
-
-##
-# @if jp
-# @class PostComponentActionListenerHolder
-# @brief PostComponentActionListener ホルダクラス
-#
-# 複数の PostComponentActionListener を保持し管理するクラス。
-#
-# @else
-# @class PostComponentActionListenerHolder
-# @brief PostComponentActionListener holder class
-#
-# This class manages one ore more instances of
-# PostComponentActionListener class.
-#
-# @endif
-class PostComponentActionListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- return
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(PostComponentActionListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(PostComponentActionListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- #void notify(UniqueId ec_id, ReturnCode_t ret);
- def notify(self, ec_id, ret):
- for listener in self._listeners:
- listener.listener(ec_id, ret)
- return
-
-
-
-#============================================================
-##
-# @if jp
-# @class PortActionListenerHolder
-# @brief PortActionListener ホルダクラス
-#
-# 複数の PortActionListener を保持し管理するクラス。
-#
-# @else
-# @class PortActionListenerHolder
-# @brief PortActionListener holder class
-#
-# This class manages one ore more instances of
-# PortActionListener class.
-#
-# @endif
-class PortActionListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- pass
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(PortActionListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(PortActionListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- #void notify(const RTC::PortProfile& pprofile);
- def notify(self, pprofile):
- for listener in self._listeners:
- listener.listener(pprofile)
- return
-
-
-
-##
-# @if jp
-# @class ExecutionContextActionListenerHolder
-# @brief ExecutionContextActionListener ホルダクラス
-#
-# 複数の ExecutionContextActionListener を保持し管理するクラス。
-#
-# @else
-# @class ExecutionContextActionListenerHolder
-# @brief ExecutionContextActionListener holder class
-#
-# This class manages one ore more instances of
-# ExecutionContextActionListener class.
-#
-# @endif
-class ExecutionContextActionListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- pass
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(ExecutionContextActionListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(ExecutionContextActionListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- #void notify(UniqueId ec_id);
- def notify(self, ec_id):
- for listener in self._listeners:
- listener.listener(ec_id)
- return
-
-
-
-##
-# @if jp
-# @class ComponentActionListeners
-# @brief ComponentActionListeners クラス
-#
-#
-# @else
-# @class ComponentActionListeners
-# @brief ComponentActionListeners class
-#
-#
-# @endif
-class ComponentActionListeners:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- # @brief PreComponentActionListenerTypeリスナ配列
- # PreComponentActionListenerTypeリスナを格納
- # @else
- # @brief PreComponentActionListenerType listener array
- # The PreComponentActionListenerType listener is stored.
- # @endif
- preaction_num = PreComponentActionListenerType.PRE_COMPONENT_ACTION_LISTENER_NUM
- preaction_ = [PreComponentActionListenerHolder()
- for i in range(preaction_num)]
-
- ##
- # @if jp
- # @brief PostComponentActionListenerTypeリスナ配列
- # PostComponentActionListenerTypeリスナを格納
- # @else
- # @brief PostComponentActionListenerType listener array
- # The PostComponentActionListenerType listener is stored.
- # @endif
- postaction_num = PostComponentActionListenerType.POST_COMPONENT_ACTION_LISTENER_NUM
- postaction_ = [PostComponentActionListenerHolder()
- for i in range(postaction_num)]
-
- ##
- # @if jp
- # @brief PortActionListenerTypeリスナ配列
- # PortActionListenerTypeリスナを格納
- # @else
- # @brief PortActionListenerType listener array
- # The PortActionListenerType listener is stored.
- # @endif
- portaction_num = PortActionListenerType.PORT_ACTION_LISTENER_NUM
- portaction_ = [PortActionListenerHolder()
- for i in range(portaction_num)]
-
- ##
- # @if jp
- # @brief ExecutionContextActionListenerTypeリスナ配列
- # ExecutionContextActionListenerTypeリスナを格納
- # @else
- # @brief ExecutionContextActionListenerType listener array
- # The ExecutionContextActionListenerType listener is stored.
- # @endif
- ecaction_num = ExecutionContextActionListenerType.EC_ACTION_LISTENER_NUM
- ecaction_ = [ExecutionContextActionListenerHolder()
- for i in range(ecaction_num)]
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,837 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file ConfigurationListener.py
-# @brief Configuration related event listener classes
-# @date $Date$
-# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-import OpenRTM_aist
-
-##
-# @if jp
-# @brief ConfigurationParamListener のタイプ
-#
-# - ON_UPDATE_CONFIG_PARAM,
-#
-# @else
-# @brief The types of ConnectorDataListener
-#
-# - ON_UPDATE_CONFIG_PARAM,
-#
-# @endif
-#
-class ConfigurationParamListenerType:
- """
- """
-
- def __init__(self):
- pass
-
- ON_UPDATE_CONFIG_PARAM = 0
- CONFIG_PARAM_LISTENER_NUM = 1
-
-
-
-##
-# @if jp
-# @class ConfigurationParamListener クラス
-# @brief ConfigurationParamListener クラス
-#
-# Configuration パラメータの変更に関するリスナクラス。
-# 以下のイベントに対してコールバックされる。
-#
-# - ON_UPDATE_CONFIG_PARAM
-#
-# @else
-# @class ConfigurationParamListener class
-# @brief ConfigurationParamListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events for Configuration parameter.
-# The listener will be called on the following event.
-#
-# - ON_UPDATE_CONFIG_PARAM
-#
-# @endif
-class ConfigurationParamListener:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief ConfigurationParamListenerType を文字列に変換
- #
- # ConfigurationParamListenerType を文字列に変換する
- #
- # @param type 変換対象 ConfigurationParamListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert ConfigurationParamListenerType into the string.
- #
- # Convert ConfigurationParamListenerType into the string.
- #
- # @param type The target ConfigurationParamListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- # static const char* toString(ConfigurationParamListenerType type)
- def toString(type):
- typeString = ["ON_UPDATE_CONFIG_PARAM",
- "CONFIG_PARAM_LISTENER_NUM"]
-
- if type < ConfigurationParamListenerType.CONFIG_PARAM_LISTENER_NUM:
- return typeString[type]
-
- return "";
-
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # ConfigurationParamListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for ConfigurationParamListener.
- #
- # @endif
- # virtual void operator()(const char* config_set_name,
- # const char* config_param_name) = 0;
- def __call__(self, config_set_name, config_param_name):
- pass
-
-
-
-#============================================================
-##
-# @if jp
-# @brief ConfigurationSetListener のタイプ
-#
-# - ON_SET_CONFIG_SET: ConfigurationSet 単位で値がセットされた
-# - ON_ADD_CONFIG_SET: ConfigurationSet が追加された
-#
-# @else
-# @brief The types of ConfigurationSetListener
-#
-# - ON_SET_CONFIG_SET: Value list has been set as a configuration set
-# - ON_ADD_CONFIG_SET: A new configuration set has been added
-#
-# @endif
-class ConfigurationSetListenerType:
- """
- """
-
- def __init__(self):
- pass
-
- ON_SET_CONFIG_SET = 0
- ON_ADD_CONFIG_SET = 1
- CONFIG_SET_LISTENER_NUM = 2
-
-
-
-##
-# @if jp
-# @class ConfigurationSetListener クラス
-# @brief ConfigurationSetListener クラス
-#
-# Configurationセットが変更されたり追加された場合に呼び出されるリスナクラス。
-# 以下のConfigurationセットに関連するイベントに対するリスナ。
-#
-# - ON_SET_CONFIG_SET: ConfigurationSet 単位で値がセットされた
-# - ON_ADD_CONFIG_SET: ConfigurationSet が追加された
-#
-# @else
-# @class ConfigurationSetListener class
-# @brief ConfigurationSetListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for configuration set's related events.
-#
-# - ON_SET_CONFIG_SET: Value list has been set as a configuration set
-# - ON_ADD_CONFIG_SET: A new configuration set has been added
-#
-# @endif
-class ConfigurationSetListener:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief ConfigurationSetListenerType を文字列に変換
- #
- # ConfigurationSetListenerType を文字列に変換する
- #
- # @param type 変換対象 ConfigurationSetListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert ConfigurationSetListenerType into the string.
- #
- # Convert ConfigurationSetListenerType into the string.
- #
- # @param type The target ConfigurationSetListenerType for
- # transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- # static const char* toString(ConfigurationSetListenerType type)
- def toString(type):
- typeString = ["ON_SET_CONFIG_SET",
- "ON_ADD_CONFIG_SET",
- "CONFIG_SET_LISTENER_NUM"]
- if type < ConfigurationSetListenerType.CONFIG_SET_LISTENER_NUM:
- return typeString[type]
-
- return "";
-
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # ConfigurationSetListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for ConfigurationSetListener
- #
- # @endif
- # virtual void operator()(const coil::Properties& config_set) = 0;
- def __call__(self, config_set):
- pass
-
-
-
-#============================================================
-##
-# @if jp
-# @brief ConfigurationSetNameListenerType
-#
-# @else
-# @brief The types of ConfigurationSetNameListener
-#
-# @endif
-class ConfigurationSetNameListenerType:
- """
- """
-
- def __init__(self):
- pass
-
- ON_UPDATE_CONFIG_SET = 0
- ON_REMOVE_CONFIG_SET = 1
- ON_ACTIVATE_CONFIG_SET = 2
- CONFIG_SET_NAME_LISTENER_NUM = 3
-
-
-
-##
-# @if jp
-# @class ConfigurationSetNameListener クラス
-# @brief ConfigurationSetNameListener クラス
-#
-# ConfigurationSetに関するイベントに関するリスナークラス。
-#
-# - ON_UPDATE_CONFIG_SET:
-# - ON_REMOVE_CONFIG_SET:
-# - ON_ACTIVATE_CONFIG_SET:
-#
-# @else
-# @class ConfigurationSetNameListener class
-# @brief ConfigurationSetNameListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events for ConfigurationSet.
-#
-# - ON_UPDATE_CONFIG_SET:
-# - ON_REMOVE_CONFIG_SET:
-# - ON_ACTIVATE_CONFIG_SET:
-#
-# @endif
-class ConfigurationSetNameListener:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief ConfigurationSetNameListenerType を文字列に変換
- #
- # ConfigurationSetNameListenerType を文字列に変換する
- #
- # @param type 変換対象 ConfigurationSetNameListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert ConfigurationSetNameListenerType into the string.
- #
- # Convert ConfigurationSetNameListenerType into the string.
- #
- # @param type The target ConfigurationSetNameListenerType for
- # transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- # static const char* toString(ConfigurationSetNameListenerType type)
- def toString(type):
- typeString = ["ON_UPDATE_CONFIG_SET",
- "ON_REMOVE_CONFIG_SET",
- "ON_ACTIVATE_CONFIG_SET",
- "CONFIG_SET_NAME_LISTENER_NUM"]
- if type < ConfigurationSetNameListenerType.CONFIG_SET_NAME_LISTENER_NUM:
- return typeString[type]
-
- return "";
-
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # ConfigurationSetNameListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for ConfigurationSetNameListener.
- #
- # @endif
- # virtual void operator()(const char* config_set_name) = 0;
- def __call__(self, config_set_name):
- pass
-
-
-
-##
-# @if jp
-#
-# @class Entry
-# @brief リスナーと自動削除フラグ格納用の汎用クラス
-#
-# リスナーオブジェクトと自動削除のためのフラグを格納するための汎用クラス
-#
-# @else
-#
-# @class Entry
-# @brief Listner and autoclean-flag holder class
-#
-# A general-purpose class to store away a listener object and
-# a flag for automatic deletion
-#
-# @endif
-class Entry:
- def __init__(self,listener,autoclean):
- self.listener = listener
- self.autoclean = autoclean
- return
-
-
-
-##
-# @if jp
-# @class ConfigurationParamListenerHolder
-# @brief ConfigurationParamListener ホルダクラス
-#
-# 複数の ConfigurationParamListener を保持し管理するクラス。
-#
-# @else
-# @class ConfigurationParamListenerHolder
-# @brief ConfigurationParamListener holder class
-#
-# This class manages one ore more instances of
-# ConfigurationParamListener class.
-#
-# @endif
-class ConfigurationParamListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- # ConfigurationParamListenerHolder();
- def __init__(self):
- self._listeners = []
- pass
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- # void addListener(ConfigurationParamListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- # void removeListener(ConfigurationParamListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- # void notify(const char* config_set_name, const char* config_param_name);
- def notify(self, config_set_name, config_param_name):
- for listener in self._listeners:
- listener.listener(config_set_name, config_param_name)
- return
-
-
-
-#============================================================
-##
-# @if jp
-# @class ConfigurationSetListenerHolder
-# @brief ConfigurationSetListener ホルダクラス
-#
-# 複数の ConfigurationSetListener を保持し管理するクラス。
-#
-# @else
-# @class ConfigurationSetListenerHolder
-# @brief ConfigurationSetListener holder class
-#
-# This class manages one ore more instances of
-# ConfigurationSetListener class.
-#
-# @endif
-class ConfigurationSetListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- # ConfigurationSetListenerHolder();
- def __init__(self):
- self._listeners = []
- pass
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- # void addListener(ConfigurationSetListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- # void removeListener(ConfigurationSetListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- # void notify(const coil::Properties& config_set);
- def notify(self, config_set):
- for listener in self._listeners:
- listener.listener(config_set)
- return
-
-
-
-#============================================================
-##
-# @if jp
-# @class ConfigurationSetNameListenerHolder
-# @brief ConfigurationSetNameListener ホルダクラス
-#
-# 複数の ConfigurationSetNameListener を保持し管理するクラス。
-#
-# @else
-# @class ConfigurationSetNameListenerHolder
-# @brief ConfigurationSetNameListener holder class
-#
-# This class manages one ore more instances of
-# ConfigurationSetNameListener class.
-#
-# @endif
-class ConfigurationSetNameListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- # ConfigurationSetNameListenerHolder();
- def __init__(self):
- self._listeners = []
- pass
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- for (idx, listener) in enumerate(self._listeners):
- if listener.autoclean:
- self._listeners[idx] = None
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- # void addListener(ConfigurationSetNameListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- self._listeners.append(Entry(listener, autoclean))
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- # void removeListener(ConfigurationSetNameListener* listener);
- def removeListener(self, listener):
- len_ = len(self._listeners)
- for i in range(len_):
- idx = (len_ - 1) - i
- if self._listeners[idx].listener == listener:
- if self._listeners[idx].autoclean:
- self._listeners[idx].listener = None
- del self._listeners[idx]
- return
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @endif
- # void notify(const char* config_set_name);
- def notify(self, config_set_name):
- for listener in self._listeners:
- listener.listener(config_set_name)
- return
-
-
-
-#------------------------------------------------------------
-##
-# @if jp
-# @class ConfigurationActionListeners
-# @brief ConfigurationActionListeners クラス
-#
-#
-# @else
-# @class ConfigurationActionListeners
-# @brief ConfigurationActionListeners class
-#
-#
-# @endif
-class ConfigurationListeners:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- # @brief ConfigurationParamListenerTypeリスナ配列
- # ConfigurationParamTypeリスナを格納
- # @else
- # @brief ConfigurationParamListenerType listener array
- # The ConfigurationParamListenerType listener is stored.
- # @endif
- configparam_num = ConfigurationParamListenerType.CONFIG_PARAM_LISTENER_NUM
- configparam_ = [ConfigurationParamListenerHolder()
- for i in range(configparam_num)]
-
- ##
- # @if jp
- # @brief ConfigurationSetListenerTypeリスナ配列
- # ConfigurationSetListenerTypeリスナを格納
- # @else
- # @brief ConfigurationSetListenerType listener array
- # The ConfigurationSetListenerType listener is stored.
- # @endif
- configset_num = ConfigurationSetListenerType.CONFIG_SET_LISTENER_NUM
- configset_ = [ConfigurationSetListenerHolder()
- for i in range(configset_num)]
-
- ##
- # @if jp
- # @brief ConfigurationSetNameListenerTypeリスナ配列
- # ConfigurationSetNameListenerTypeリスナを格納
- # @else
- # @brief ConfigurationSetNameListenerType listener array
- # The ConfigurationSetNameListenerType listener is stored.
- # @endif
- configsetname_num = ConfigurationSetNameListenerType.CONFIG_SET_NAME_LISTENER_NUM
- configsetname_ = [ConfigurationSetNameListenerHolder()
- for i in range(configsetname_num)]
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/NVUtil.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/NVUtil.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/NVUtil.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -308,11 +308,7 @@
# @return string value named by name
#
# @endif
-def toString(nv, name=None):
- if not name:
- str_ = [""]
- return dump_to_stream(str_, nv)
-
+def toString(nv, name):
str_value = ""
try:
ret_value = find(nv, name)
@@ -390,24 +386,6 @@
##
# @if jp
-# @brief NVList に設定されている内容を文字列として出力する。
-# @else
-# @brief Print information configured in NVList as a string type
-# @endif
-# std::ostream& dump_to_stream(std::ostream& out, const SDOPackage::NVList& nv)
-def dump_to_stream(out, nv):
- for i in range(len(nv)):
- val = any.from_any(nv[i].value, keep_structs=True)
- if type(val) == str:
- out[0] += (nv[i].name + ": " + str(nv[i].value) + "\n")
- else:
- out[0] += (nv[i].name + ": not a string value \n")
-
- return out[0]
-
-
-##
-# @if jp
#
# @brief NVList に設定されている内容を文字列として出力する。
#
@@ -421,5 +399,8 @@
#
# @endif
def dump(nv):
- out = [""]
- print dump_to_stream(out, nv)
+ for i in range(len(nv)):
+ if type(nv[i].value) == str:
+ print nv[i].name, ": ", nv[i].value
+ else:
+ print nv[i].name, ": not a string value"
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -166,27 +166,8 @@
self._onDisconnected = None
self._onConnectionLost = None
self._connectionLimit = -1
- self._portconnListeners = None
- return
-
- ##
- # @if jp
- #
- # @brief デストラクタ
- #
- # デストラクタでは、PortService CORBA オブジェクトの deactivate を
- # 行う。deactivateに際して例外を投げることはない。
- #
- # @else
- #
- # @brief Destructor
- #
- # In the destructor, PortService CORBA object is deactivated.
- # This function never throws exception.
- #
- # @endif
- #
+
def __del__(self):
self._rtcout.RTC_TRACE("PortBase.__del__()")
try:
@@ -693,12 +674,10 @@
# publish owned interface information to the ConnectorProfile
retval = [RTC.RTC_OK for i in range(3)]
- self.onNotifyConnect(self.getName(),connector_profile)
retval[0] = self.publishInterfaces(connector_profile)
if retval[0] != RTC.RTC_OK:
self._rtcout.RTC_ERROR("publishInterfaces() in notify_connect() failed.")
- self.onPublishInterfaces(self.getName(), connector_profile, retval[0])
if self._onPublishInterfaces:
self._onPublishInterfaces(connector_profile)
@@ -707,18 +686,14 @@
if retval[1] != RTC.RTC_OK:
self._rtcout.RTC_ERROR("connectNext() in notify_connect() failed.")
- self.onConnectNextport(self.getName(), connector_profile, retval[1])
# subscribe interface from the ConnectorProfile's information
if self._onSubscribeInterfaces:
self._onSubscribeInterfaces(connector_profile)
-
retval[2] = self.subscribeInterfaces(connector_profile)
if retval[2] != RTC.RTC_OK:
self._rtcout.RTC_ERROR("subscribeInterfaces() in notify_connect() failed.")
#self.notify_disconnect(connector_profile.connector_id)
- self.onSubscribeInterfaces(self.getName(), connector_profile, retval[2])
-
self._rtcout.RTC_PARANOID("%d connectors are existing",
len(self._profile.connector_profiles))
@@ -736,13 +711,12 @@
for ret in retval:
if ret != RTC.RTC_OK:
- self.onConnected(self.getName(), connector_profile, ret)
return (ret, connector_profile)
# connection established without errors
if self._onConnected:
self._onConnected(connector_profile)
- self.onConnected(self.getName(), connector_profile, RTC.RTC_OK)
+
return (RTC.RTC_OK, connector_profile)
@@ -953,14 +927,11 @@
self._profile.connector_profiles[index].connector_id,
self._profile.connector_profiles[index].ports,
self._profile.connector_profiles[index].properties)
- self.onNotifyDisconnect(self.getName(), prof)
retval = self.disconnectNext(prof)
- self.onDisconnectNextport(self.getName(), prof, retval)
if self._onUnsubscribeInterfaces:
self._onUnsubscribeInterfaces(prof)
- self.onUnsubscribeInterfaces(self.getName(), prof)
self.unsubscribeInterfaces(prof)
if self._onDisconnected:
@@ -968,7 +939,6 @@
OpenRTM_aist.CORBA_SeqUtil.erase(self._profile.connector_profiles, index)
- self.onDisconnected(self.getName(), prof, retval)
return retval
@@ -1225,7 +1195,6 @@
self._onPublishInterfaces = on_publish
return
-
##
# @if jp
#
@@ -1437,36 +1406,9 @@
self._onConnectionLost = on_connection_lost
return
-
##
# @if jp
- # @brief PortConnectListeners のホルダをセットする
#
- # ポートの接続に関するリスナ群を保持するホルダクラスへのポインタを
- # セットする。この関数は通常親のRTObjectから呼ばれ、RTObjectが持つ
- # ホルダクラスへのポインタがセットされる。
- #
- # @param portconnListeners PortConnectListeners オブジェクトのポインタ
- #
- # @else
- # @brief Setting PortConnectListener holder
- #
- # This operation sets a functor that is called when connection
- # of this port does lost.
- #
- # @param on_connection_lost a pointer to ConnectionCallback's subclasses
- #
- # @endif
- #
- # void setPortConnectListenerHolder(PortConnectListeners* portconnListeners);
- def setPortConnectListenerHolder(self, portconnListeners):
- self._portconnListeners = portconnListeners
- return
-
-
- ##
- # @if jp
- #
# @brief Interface 情報を公開する(サブクラス実装用)
#
# このオペレーションは、notify_connect() 処理シーケンスの始めにコール
@@ -2266,94 +2208,7 @@
return True
- #inline void onNotifyConnect(const char* portname,
- # RTC::ConnectorProfile& profile)
- def onNotifyConnect(self, portname, profile):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_CONNECT
- self._portconnListeners.portconnect_[type].notify(portname, profile)
- return
-
- #inline void onNotifyDisconnect(const char* portname,
- # RTC::ConnectorProfile& profile)
- def onNotifyDisconnect(self, portname, profile):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_DISCONNECT
- self._portconnListeners.portconnect_[type].notify(portname, profile)
- return
-
-
- #inline void onUnsubscribeInterfaces(const char* portname,
- # RTC::ConnectorProfile& profile)
- def onUnsubscribeInterfaces(self, portname, profile):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectListenerType.ON_UNSUBSCRIBE_INTERFACES
- self._portconnListeners.portconnect_[type].notify(portname, profile)
- return
-
-
- #inline void onPublishInterfaces(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onPublishInterfaces(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_UNSUBSCRIBE_INTERFACES
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
- #inline void onConnectNextport(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onConnectNextport(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_CONNECT_NEXTPORT
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
- #inline void onSubscribeInterfaces(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onSubscribeInterfaces(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_SUBSCRIBE_INTERFACES
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
- #inline void onConnected(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onConnected(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_CONNECTED
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
- #inline void onDisconnectNextport(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onDisconnectNextport(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_DISCONNECT_NEXT
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
- #inline void onDisconnected(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret)
- def onDisconnected(self, portname, profile, ret):
- if self._portconnListeners != None:
- type = OpenRTM_aist.PortConnectRetListenerType.ON_DISCONNECTED
- self._portconnListeners.portconnret_[type].notify(portname, profile, ret)
- return
-
-
-
#============================================================
# Functor
#============================================================
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortConnectListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortConnectListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/PortConnectListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,551 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file PortConnectListener.py
-# @brief port's internal action listener classes
-# @date $Date$
-# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-
-#============================================================
-
-##
-# @if jp
-# @brief PortConnectListener のタイプ
-#
-# - ON_NOTIFY_CONNECT: notify_connect() 関数内呼び出し直後
-# - ON_NOTIFY_DISCONNECT: notify_disconnect() 呼び出し直後
-# - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() 内のIF購読解除時
-#
-# @else
-# @brief The types of ConnectorDataListener
-#
-# - ON_NOTIFY_CONNECT: right after entering into notify_connect()
-# - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect()
-# - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect()
-#
-# @endif
-class PortConnectListenerType:
- """
- """
-
- ON_NOTIFY_CONNECT = 0
- ON_NOTIFY_DISCONNECT = 1
- ON_UNSUBSCRIBE_INTERFACES = 2
- PORT_CONNECT_LISTENER_NUM = 3
-
- def __init__(self):
- pass
-
-
-
-##
-# @if jp
-# @class PortConnectListener クラス
-# @brief PortConnectListener クラス
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスナクラスの基底クラス。
-#
-# - ON_NOTIFY_CONNECT: notify_connect() 関数内呼び出し直後
-# - ON_NOTIFY_DISCONNECT: notify_disconnect() 呼び出し直後
-# - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() 内のIF購読解除時
-#
-# @else
-# @class PortConnectListener class
-# @brief PortConnectListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# - ON_NOTIFY_CONNECT: right after entering into notify_connect()
-# - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect()
-# - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect()
-#
-# @endif
-class PortConnectListener:
- """
- """
-
- def __init__(self):
- pass
-
- ##
- # @if jp
- #
- # @brief PortConnectListenerType を文字列に変換
- #
- # PortConnectListenerType を文字列に変換する
- #
- # @param type 変換対象 PortConnectListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert PortConnectListenerType into the string.
- #
- # Convert PortConnectListenerType into the string.
- #
- # @param type The target PortConnectListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- #static const char* toString(PortConnectListenerType type);
- def toString(type):
- typeString = ["ON_NOTIFY_CONNECT",
- "ON_NOTIFY_DISCONNECT",
- "ON_UNSUBSCRIBE_INTERFACES",
- "ON_UPDATE_CONFIG_PARAM",
- ""]
-
- if type < ConfigurationParamListenerType.CONFIG_PARAM_LISTENER_NUM:
- return typeString[type]
-
- return "";
-
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # PortConnectListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for PortConnectListener.
- #
- # @endif
- #virtual void operator()(const char* portname,
- # RTC::ConnectorProfile& profile) = 0;
- def __call__(self, portname, profile):
- return
-
-
-
-#============================================================
-##
-# @if jp
-# @brief PortConnectRetListenerType のタイプ
-#
-# - ON_CONNECT_NEXTPORT: notify_connect() 中のカスケード呼び出し直後
-# - ON_SUBSCRIBE_INTERFACES: notify_connect() 中のインターフェース購読直後
-# - ON_CONNECTED: nofity_connect() 接続処理完了時に呼び出される
-# - ON_DISCONNECT_NEXT: notify_disconnect() 中にカスケード呼び出し直後
-# - ON_DISCONNECTED: notify_disconnect() リターン時
-#
-# @else
-# @brief The types of PortConnectRetListenerType
-#
-# - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect()
-# - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect()
-# - ON_CONNECTED: completed nofity_connect() connection process
-# - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect()
-# - ON_DISCONNECTED: completed notify_disconnect() disconnection
-#
-# @endif
-class PortConnectRetListenerType:
- """
- """
-
- ON_PUBLISH_INTERFACES = 0
- ON_CONNECT_NEXTPORT = 1
- ON_SUBSCRIBE_INTERFACES = 2
- ON_CONNECTED = 3
- ON_DISCONNECT_NEXT = 4
- ON_DISCONNECTED = 5
- PORT_CONNECT_RET_LISTENER_NUM = 6
-
- def __init__(self):
- pass
-
-
-
-##
-# @if jp
-# @class PortConnectRetListener クラス
-# @brief PortConnectRetListener クラス
-#
-# 各アクションに対応するユーザーコードが呼ばれる直前のタイミング
-# でコールされるリスなクラスの基底クラス。
-#
-# - ON_PUBLISH_INTERFACES: notify_connect() 中のインターフェース公開直後
-# - ON_CONNECT_NEXTPORT: notify_connect() 中のカスケード呼び出し直後
-# - ON_SUBSCRIBE_INTERFACES: notify_connect() 中のインターフェース購読直後
-# - ON_CONNECTED: nofity_connect() 接続処理完了時に呼び出される
-# - ON_DISCONNECT_NEXT: notify_disconnect() 中にカスケード呼び出し直後
-# - ON_DISCONNECTED: notify_disconnect() リターン時
-#
-# @else
-# @class PortConnectRetListener class
-# @brief PortConnectRetListener class
-#
-# This class is abstract base class for listener classes that
-# provides callbacks for various events in rtobject.
-#
-# - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect()
-# - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect()
-# - ON_CONNECTED: completed nofity_connect() connection process
-# - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect()
-# - ON_DISCONNECTED: completed notify_disconnect() disconnection
-#
-# @endif
-class PortConnectRetListener:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief PortConnectRetListenerType を文字列に変換
- #
- # PortConnectRetListenerType を文字列に変換する
- #
- # @param type 変換対象 PortConnectRetListenerType
- #
- # @return 文字列変換結果
- #
- # @else
- #
- # @brief Convert PortConnectRetListenerType into string.
- #
- # Convert PortConnectRetListenerType into string.
- #
- # @param type The target PortConnectRetListenerType for transformation
- #
- # @return Trnasformation result of string representation
- #
- # @endif
- #static const char* toString(PortConnectRetListenerType type);
- def toString(type):
- return
- toString = staticmethod(toString)
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief 仮想コールバック関数
- #
- # PortConnectRetListener のコールバック関数
- #
- # @else
- #
- # @brief Virtual Callback function
- #
- # This is a the Callback function for PortConnectRetListener.
- #
- # @endif
- #virtual void operator()(const char* portname,
- # RTC::ConnectorProfile& profile,
- # ReturnCode_t ret) = 0;
- def __call__(self, portname, profile, ret):
- pass
-
-
-
-class Entry:
- def __init__(self,listener, autoclean):
- self.listener = listener
- self.autoclean = autoclean
- return
-
-#============================================================
-##
-# @if jp
-# @class PortConnectListenerHolder
-# @brief PortConnectListener ホルダクラス
-#
-# 複数の PortConnectListener を保持し管理するクラス。
-#
-# @else
-# @class PortConnectListenerHolder
-# @brief PortConnectListener holder class
-#
-# This class manages one ore more instances of
-# PortConnectListener class.
-#
-# @endif
-class PortConnectListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(PortConnectListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(PortConnectListener* listener);
- def removeListener(self, listener):
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @endif
- #void notify(const char* portname, RTC::ConnectorProfile& profile);
- def notify(self, portname, profile):
- pass
-
-
-
-##
-# @if jp
-# @class PortConnectRetListenerHolder
-# @brief PortConnectRetListener ホルダクラス
-#
-# 複数の PortConnectRetListener を保持し管理するクラス。
-#
-# @else
-# @class PortConnectRetListenerHolder
-# @brief PortConnectRetListener holder class
-#
-# This class manages one ore more instances of
-# PortConnectRetListener class.
-#
-# @endif
-class PortConnectRetListenerHolder:
- """
- """
-
- ##
- # @if jp
- # @brief コンストラクタ
- # @else
- # @brief Constructor
- # @endif
- #PortConnectRetListenerHolder();
- def __init__(self):
- self._listeners = []
- return
-
-
- ##
- # @if jp
- # @brief デストラクタ
- # @else
- # @brief Destructor
- # @endif
- def __del__(self):
- pass
-
-
- ##
- # @if jp
- #
- # @brief リスナーの追加
- #
- # リスナーを追加する。
- #
- # @param listener 追加するリスナ
- # @param autoclean true:デストラクタで削除する,
- # false:デストラクタで削除しない
- # @else
- #
- # @brief Add the listener.
- #
- # This method adds the listener.
- #
- # @param listener Added listener
- # @param autoclean true:The listener is deleted at the destructor.,
- # false:The listener is not deleted at the destructor.
- # @endif
- #void addListener(PortConnectRetListener* listener, bool autoclean);
- def addListener(self, listener, autoclean):
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーの削除
- #
- # リスナを削除する。
- #
- # @param listener 削除するリスナ
- # @else
- #
- # @brief Remove the listener.
- #
- # This method removes the listener.
- #
- # @param listener Removed listener
- # @endif
- #void removeListener(PortConnectRetListener* listener);
- def removeListener(self, listener):
- return
-
-
- ##
- # @if jp
- #
- # @brief リスナーへ通知する
- #
- # 登録されているリスナのコールバックメソッドを呼び出す。
- #
- # @param info ConnectorInfo
- # @param cdrdata データ
- # @else
- #
- # @brief Notify listeners.
- #
- # This calls the Callback method of the registered listener.
- #
- # @param info ConnectorInfo
- # @param cdrdata Data
- # @endif
- #void notify(const char* portname, RTC::ConnectorProfile& profile,
- # ReturnCode_t ret);
- def notify(self, portname, profile, ret):
- return
-
-
-
-##
-# @if jp
-# @class PortConnectListeners
-# @brief PortConnectListeners クラス
-#
-#
-# @else
-# @class PortConnectListeners
-# @brief PortConnectListeners class
-#
-#
-# @endif
-class PortConnectListeners:
- """
- """
-
- def __init__(self):
- pass
-
-
- ##
- # @if jp
- # @brief PortConnectListenerType リスナ配列
- # PortConnectListenerType リスナを格納
- # @else
- # @brief PortConnectListenerType listener array
- # The PortConnectListenerType listener is stored.
- # @endif
- portconnect_num = PortConnectListenerType.PORT_CONNECT_LISTENER_NUM
- portconnect_ = [PortConnectListenerHolder() for i in range(portconnect_num)]
-
- ##
- # @if jp
- # @brief PortConnectRetTypeリスナ配列
- # PortConnectRetTypeリスナを格納
- # @else
- # @brief PortConnectRetType listener array
- # The PortConnectRetType listener is stored.
- # @endif
- portconnret_num = PortConnectRetListenerType.PORT_CONNECT_RET_LISTENER_NUM
- portconnret_ = [PortConnectRetListenerHolder() for i in range(portconnret_num)]
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoConfiguration.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoConfiguration.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoConfiguration.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -173,19 +173,15 @@
# コンストラクタ
#
# @param self
- # @param configAdmin ConfigurationSetList
- # @param sdoServiceAdmin SdoServiceAdmin
+ # @param configsets ConfigurationSetList
#
# @else
# @brief class constructor
# @param self
- # @param configAdmin ConfigurationSetList
- # @param sdoServiceAdmin SdoServiceAdmin
+ # @param configsets ConfigurationSetList
#
# @endif
- # Configuration_impl(RTC::ConfigAdmin& configAdmin,
- # RTC::SdoServiceAdmin& sdoServiceAdmin);
- def __init__(self, configAdmin, sdoServiceAdmin):
+ def __init__(self, configsets):
"""
\var self._deviceProfile SDO DeviceProfile with mutex lock
"""
@@ -201,11 +197,9 @@
self._parameters = []
self._params_mutex = threading.RLock()
- self._configsets = configAdmin
+ self._configsets = configsets
self._config_mutex = threading.RLock()
- self._sdoservice = sdoServiceAdmin
-
"""
\var self._organizations SDO OrganizationList
"""
@@ -330,12 +324,24 @@
raise SDOPackage.InvalidParameter("sProfile is empty.")
try:
- return self._sdoservice.addSdoServiceConsumer(sProfile)
+ if not sProfile.id:
+ prof = sProfile
+ prof.id = self.getUUID()
+ OpenRTM_aist.CORBA_SeqUtil.push_back(self._serviceProfiles, prof)
+ return True
+
+ index = OpenRTM_aist.CORBA_SeqUtil.find(self._serviceProfiles,
+ self.service_id(sProfile.id))
+ if index >= 0:
+ OpenRTM_aist.CORBA_SeqUtil.erase(self._serviceProfiles, index)
+
+ OpenRTM_aist.CORBA_SeqUtil.push_back(self._serviceProfiles, sProfile)
+ return True
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
raise SDOPackage.InternalError("Configuration.add_service_profile")
- return False
+ return True
##
@@ -436,12 +442,12 @@
raise SDOPackage.InvalidParameter("id is empty.")
try:
- return self._sdoservice.removeSdoServiceConsumer(id_)
+ OpenRTM_aist.CORBA_SeqUtil.erase_if(self._serviceProfiles, self.service_id(id_))
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
raise SDOPackage.InternalError("Configuration.remove_service_profile")
- return False
+ return True
##
@@ -791,14 +797,8 @@
guard = OpenRTM_aist.ScopedLock(self._config_mutex)
- try:
- if not self._configsets.haveConfig(config_id):
- self._rtcout.RTC_ERROR("No such ConfigurationSet")
- raise SDOPackage.InternalError("No such ConfigurationSet")
- except:
- self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- raise SDOPackage.InternalError("Unknown exception")
-
+ if not self._configsets.haveConfig(config_id):
+ raise SDOPackage.InternalError("No such ConfigurationSet")
configset = self._configsets.getConfigurationSet(config_id)
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,332 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file SdoServiceAdmin.py
-# @brief SDO service administration class
-# @date $Date$
-# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-import copy
-import threading
-import OpenRTM_aist
-
-
-##
-# @if jp
-#
-# @class SDO service administration class
-# @brief SDO service 管理クラス
-#
-# このクラスは、SDO Service を管理するためのクラスである。SDO
-# Service は OMG SDO Specification において定義されている、SDOが特定
-# の機能のために提供また要求するサービスの一つである。詳細は仕様にお
-# いて定義されていないが、本クラスでは以下のように振る舞うサービスで
-# あるものとし、これらを管理するためのクラスが本クラスである。
-#
-# SDO Service においては、SDO/RTCに所有され、ある種のサービスを提供
-# するものを SDO Service Provider、他のSDO/RTCやアプリケーションが提
-# 供するサービスオブジェクトの参照を受け取り、それらの機能を利用する
-# ものを、SDO Service Consumer と呼ぶ。
-#
-# SDO Service Provider は他のアプリケーションから呼ばれ、SDO/RTC内部
-# の機能にアクセスするために用いられる。他のSDO/RTCまたはアプリケー
-# ションは、
-#
-# - SDO::get_service_profiles ()
-# - SDO::get_service_profile (in UniqueIdentifier id)
-# - SDO::get_sdo_service (in UniqueIdentifier id)
-#
-# のいずれかのオペレーションにより、ServiceProfile または SDO
-# Service の参照を取得し、機能を利用するためのオペレーションを呼び出
-# す。他のSDO/RTCまたはアプリケーション上での参照の破棄は任意のタイ
-# ミングで行われ、サービス提供側では、どこからどれだけ参照されている
-# かは知ることはできない。一方で、SDO/RTC側も、任意のタイミングでサー
-# ビスの提供を停止することもできるため、サービスの利用側では、常に
-# サービスが利用できるとは限らないものとしてサービスオペレーションを
-# 呼び出す必要がある。
-#
-# 一方、SDO Service Consumer は当該SDO/RTC以外のSDO/RTCまたはアプリ
-# ケーションがサービスの実体を持ち、当該SDO/RTCにオブジェクト参照を
-# 含むプロファイルを与えることで、SDO/RTC側からサービスオペレーショ
-# ンが呼ばれ外部のSDO/RTCまたはアプリケーションが提供する機能を利用
-# できる。また、オブザーバ的なオブジェクトを与えることで、SDO/RTC側
-# からのコールバックを実現するためにも利用することができる。コンシュー
-# マは、プロバイダとは異なり、SDO Configurationインターフェースから
-# 追加、削除が行われる。関連するオペレーションは以下のとおりである。
-#
-# - Configuration::add_service_profile (in ServiceProfile sProfile)
-# - Configuration::remove_service_profile (in UniqueIdentifier id)
-#
-# 外部のSDO/RTCまたはアプリケーションは、自身が持つSDO Servcie
-# Provider の参照をIDおよびinterface type、プロパティとともに
-# ServcieProfile にセットしたうえで、add_service_profile() の引数と
-# して与えることで、当該SDO/RTCにサービスを与える。この際、IDはUUID
-# など一意なIDでなければならない。また、削除する際にはIDにより対象と
-# するServiceProfileを探索するため、サービス提供側では削除時までIDを
-# 保持しておかなければならない。
-#
-#
-#
-#
-#
-# @since 1.1.0
-#
-# @else
-#
-# @class SDO service administration class
-# @brief SDO service administration class
-#
-#
-# @since 1.1.0
-#
-# @endif
-class SdoServiceAdmin:
- """
- """
-
-
- ##
- # @if jp
- # @brief コンストラクタ
- # コンストラクタ
- # @param
- #
- # @else
- # @brief Constructor
- # Constructor
- # @param
- # @endif
- # SdoServiceAdmin(::RTC::RTObject_impl& rtobj);
- def __init__(self, rtobj):
- self._rtobj = rtobj
- self._consumerTypes = []
- self._allConsumerAllowed = True
-
- ##
- # @if jp
- # @brief Lock 付き SDO ServiceProfileList
- # @else
- # @brief SDO ServiceProfileList with mutex lock
- # @endif
- self._providerProfiles = []
- self._provider_mutex = threading.RLock()
-
- ##
- # @if jp
- # @brief Lock 付き SDO ServiceProfileList
- # @else
- # @brief SDO ServiceProfileList with mutex lock
- # @endif
- self._consumers = []
- self._consumer_mutex = threading.RLock()
-
- ##
- # @if jp
- # @brief logger
- # @else
- # @brief logger
- # @endif
- self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("SdoServiceAdmin")
-
- self._rtcout.RTC_TRACE("SdoServiceAdmin::SdoServiceAdmin(%s)",
- rtobj.getProperties().getProperty("instance_name"))
-
- # getting consumer types from RTC's properties
- prop = copy.deepcopy(self._rtobj.getProperties())
- constypes = prop.getProperty("sdo_service.consumer_types")
- self._consumerTypes = [s.strip() for s in constypes.split(",")]
- self._rtcout.RTC_DEBUG("sdo_service.consumer_types: %s",
- str(OpenRTM_aist.flatten(self._consumerTypes)))
-
- # If types include '[Aa][Ll][Ll]', all types allowed in this RTC
- for ctype in self._consumerTypes:
- tmp = ctype.lower()
- if tmp == "all":
- self._allConsumerAllowed = True
- self._rtcout.RTC_DEBUG("sdo_service.consumer_types: ALL")
-
- return
-
-
- ##
- # @if jp
- # @brief 仮想デストラクタ
- # 仮想デストラクタ。
- #
- # @else
- # @brief Virtual destractor
- # Virtual destractor.
- # @endif
- def __del__(self):
- return
-
-
- ##
- # @if jp
- # @brief Service Consumer Factory を登録する
- #
- # @else
- # @brief Add Service Consumer Factory
- # @endif
- # bool addSdoServiceConsumerFactory();
- def addSdoServiceConsumerFactory(self):
- return False
-
-
- ##
- # @if jp
- # @brief Service Consumer Factory を削除する
- #
- # @else
- # @brief Remove Service Consumer Factory
- # @endif
- # bool removeSdoServiceConsumerFactory();
- def removeSdoServiceConsumerFactory(self):
- return False
-
-
- ##
- # @if jp
- # @brief Service Consumer を追加する
- #
- # @else
- # @brief Add Service Consumer
- # @endif
- # bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& sProfile);
- def addSdoServiceConsumer(self, sProfile):
- self._rtcout.RTC_TRACE("addSdoServiceConsumer(IFR = %s)",
- sProfile.interface_type)
- profile = copy.deepcopy(sProfile)
-
- # Not supported consumer type -> error return
- if not self.isAllowedConsumerType(sProfile):
- self._rtcout.RTC_ERROR("Not supported consumer type. %s", profile.id)
- return False
-
- if not self.isExistingConsumerType(sProfile):
- self._rtcout.RTC_ERROR("type %s already exists.", profile.id)
- return False
-
- if str(profile.id) == "":
- self._rtcout.RTC_WARN("No id specified. It should be given by clients.")
- return False
-
- # re-initialization
- guard = OpenRTM_aist.ScopedLock(self._consumer_mutex)
- id = str(sProfile.id)
- for i in range(len(self._consumers)):
- if id == str(self._consumers[i].getProfile().id):
- self._rtcout.RTC_INFO("Existing consumer is reinitilized.")
- self._rtcout.RTC_DEBUG("Propeteis are: %s",
- NVUtil.toString(sProfile.properties))
- return self._consumers[i].reinit(sProfile)
- del guard
-
- # new pofile
- factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
- ctype = str(profile.interface_type)
- consumer = factory.createObject(ctype)
- if consumer == None:
- self._rtcout.RTC_ERROR("Hmm... consumer must be created.")
- return False
-
- # initialize
- if not consumer.init(self._rtobj, sProfile):
- self._rtcout.RTC_WARN("SDO service initialization was failed.")
- self._rtcout.RTC_DEBUG("id: %s", str(sProfile.id))
- self._rtcout.RTC_DEBUG("IFR: %s", str(sProfile.interface_type))
- self._rtcout.RTC_DEBUG("properties: %s", OpenRTM_aist.NVUtil.toString(sProfile.properties))
- factory.deleteObject(consumer)
- self._rtcout.RTC_INFO("SDO consumer was deleted by initialization failure")
- return False
-
- # store consumer
- guard = OpenRTM_aist.ScopedLock(self._consumer_mutex)
- self._consumers.append(consumer)
- del guard
-
- return True
-
-
- ##
- # @if jp
- # @brief Service Consumer を削除する
- #
- # @else
- # @brief Remove Service Consumer
- # @endif
- # bool removeSdoServiceConsumer(const char* id);
- def removeSdoServiceConsumer(self, id):
- if id == None or id[0] == '\0':
- self._rtcout.RTC_ERROR("removeSdoServiceConsumer(): id is invalid.")
- return False
-
- self._rtcout.RTC_TRACE("removeSdoServiceConsumer(id = %s)", id)
-
- guard = OpenRTM_aist.ScopedLock(self._consumer_mutex)
- strid = id
-
- for (idx,cons) in enumerate(self._consumers):
- if strid == str(cons.getProfile().id):
- cons.finalize()
- del self._consumers[idx]
- factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
- factory.deleteObject(cons)
- self._rtcout.RTC_INFO("SDO service has been deleted: %s", id)
- return True
-
- self._rtcout.RTC_WARN(("Specified SDO consumer not found: %s", id))
- return False
-
-
- ##
- # @if jp
- # @brief 許可されたサービス型かどうか調べる
- #
- # @else
- # @brief If it is allowed service type
- # @endif
- # bool isAllowedConsumerType(const SDOPackage::ServiceProfile& sProfile);
- def isAllowedConsumerType(self, sProfile):
- if self._allConsumerAllowed:
- return True
-
- for i in range(len(self._consumerTypes)):
- if self._consumerTypes[i] == str(sProfile.interface_type):
- self._rtcout.RTC_DEBUG("%s is supported SDO service.", str(sProfile.interface_type))
- return True
- self._rtcout.RTC_WARN("Consumer type is not supported: %s", str(sProfile.interface_type))
- return False
-
-
- ##
- # @if jp
- # @brief 存在するサービス型かどうか調べる
- #
- # @else
- # @brief If it is existing service type
- # @endif
- # bool isExistingConsumerType(const SDOPackage::ServiceProfile& sProfile);
- def isExistingConsumerType(self, sProfile):
- factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
- consumerTypes = factory.getIdentifiers()
- for i in range(len(consumerTypes)):
- if consumerTypes[i] == str(sProfile.interface_type):
- self._rtcout.RTC_DEBUG("%s exists in the SDO service factory.", str(sProfile.interface_type))
- self._rtcout.RTC_PARANOID("Available SDO serices in the factory: %s", str(OpenRTM_aist.flatten(consumerTypes)))
- return True
- self._rtcout.RTC_WARN("No available SDO service in the factory: %s",
- str(sProfile.interface_type))
- return False
-
-
- # const std::string getUUID() const;
- def getUUID(self):
- return str(OpenRTM_aist.uuid1())
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file SdoServiceConsumerBase.py
-# @brief SDO service consumer base class and its factory
-# @date $Date$
-# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-import SDOPackage
-import OpenRTM_aist
-
-
-##
-# @if jp
-#
-# SdoServiceConsumerFactory&
-# factory(SdoServiceConsumerFactory.instance());
-#
-# factory.addFactory(toRepositoryId<IDL Type>(),
-# Creator< SdoServiceConsumerBase,
-# your_sdo_service_consumer_subclass>,
-# Destructor< SdoServiceConsumerBase,
-# your_sdo_service_consumer_subclass>);
-#
-# @else
-#
-#
-#
-# @endif
-class SdoServiceConsumerBase:
- """
- """
-
- def __init__(self):
- pass
-
- # virtual bool init(RTObject_impl& rtobj,
- # const SDOPackage::ServiceProfile& profile) = 0;
- def init(self, rtobj, profile):
- pass
-
-
- # virtual bool reinit(const SDOPackage::ServiceProfile& profile) = 0;
- def reinit(self, profile):
- pass
-
-
- # virtual const SDOPackage::ServiceProfile& getProfile() const = 0;
- def getProfile(self):
- pass
-
- # virtual void finalize() = 0;
- def finalize(self):
- pass
-
-sdoserviceconsumerfactory = None
-
-class SdoServiceConsumerFactory(OpenRTM_aist.Factory,SdoServiceConsumerBase):
- def __init__(self):
- OpenRTM_aist.Factory.__init__(self)
- return
-
- def __del__(self):
- pass
-
- def instance():
- global sdoserviceconsumerfactory
-
- if sdoserviceconsumerfactory is None:
- sdoserviceconsumerfactory = SdoServiceConsumerFactory()
-
- return sdoserviceconsumerfactory
-
- instance = staticmethod(instance)
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -31,7 +31,6 @@
from DataPortStatus import *
from NumberingPolicy import *
from Listener import *
-from ComponentActionListener import *
from Typename import *
from Guard import *
from PeriodicTask import *
@@ -64,9 +63,6 @@
from uuid import *
from SdoConfiguration import *
from SdoOrganization import *
-from SdoServiceConsumerBase import *
-from SdoServiceAdmin import *
-from ConfigurationListener import *
from PeriodicECSharedComposite import *
from RTCUtil import *
from OutPortBase import *
@@ -81,7 +77,6 @@
from InPortPushConnector import *
from OutPort import *
from PortCallBack import *
-from PortConnectListener import *
from CorbaPort import *
from OutPortConnector import *
from OutPortCorbaCdrConsumer import *
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ComponentActionListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ComponentActionListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ComponentActionListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,229 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file test_ComponentActionListener.py
-# @brief test for ComponentActionListener class
-# @date $Date$
-# @author Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-
-import sys
-sys.path.insert(1,"../")
-
-import unittest
-
-from ComponentActionListener import *
-import OpenRTM_aist
-
-class MockPreComponentActionListener(PreComponentActionListener):
- def __init__(self):
- PreComponentActionListener.__init__(self)
- return
-
- def __call__(self,id):
- return id
-
-
-class MockPostComponentActionListener(PostComponentActionListener):
- def __init__(self):
- PostComponentActionListener.__init__(self)
- return
-
- def __call__(self,id,ret):
- return id,ret
-
-
-class MockPortActionListener(PortActionListener):
- def __init__(self):
- PortActionListener.__init__(self)
- return
-
- def __call__(self, pprof):
- return pprof
-
-
-class MockExecutionContextActionListener(ExecutionContextActionListener):
- def __init__(self):
- ExecutionContextActionListener.__init__(self)
- return
-
- def __call__(self, ec_id):
- return ec_id
-
-
-class TestListener(unittest.TestCase):
- def setUp(self):
- return
-
- def tearDown(self):
- OpenRTM_aist.Manager.instance().shutdownManager()
- return
-
- def test_PreComponentActionListener_toString(self):
- self.assertEqual("PRE_ON_INITIALIZE",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_INITIALIZE))
-
- self.assertEqual("PRE_ON_FINALIZE",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_FINALIZE))
-
- self.assertEqual("PRE_ON_STARTUP",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_STARTUP))
-
- self.assertEqual("PRE_ON_SHUTDOWN",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_SHUTDOWN))
-
- self.assertEqual("PRE_ON_ACTIVATED",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_ACTIVATED))
-
- self.assertEqual("PRE_ON_DEACTIVATED",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_DEACTIVATED))
-
- self.assertEqual("PRE_ON_ABORTING",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_ABORTING))
-
- self.assertEqual("PRE_ON_ERROR",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_ERROR))
-
- self.assertEqual("PRE_ON_RESET",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_RESET))
-
- self.assertEqual("PRE_ON_EXECUTE",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_EXECUTE))
-
- self.assertEqual("PRE_ON_STATE_UPDATE",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_STATE_UPDATE))
-
- self.assertEqual("PRE_ON_RATE_CHANGED",
- PreComponentActionListener.toString(
- PreComponentActionListenerType.PRE_ON_RATE_CHANGED))
-
- return
-
- def test_PostComponentActionListener_toString(self):
- self.assertEqual("POST_ON_INITIALIZE",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_INITIALIZE))
-
- self.assertEqual("POST_ON_FINALIZE",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_FINALIZE))
-
- self.assertEqual("POST_ON_STARTUP",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_STARTUP))
-
- self.assertEqual("POST_ON_SHUTDOWN",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_SHUTDOWN))
-
- self.assertEqual("POST_ON_ACTIVATED",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_ACTIVATED))
-
- self.assertEqual("POST_ON_DEACTIVATED",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_DEACTIVATED))
-
- self.assertEqual("POST_ON_ABORTING",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_ABORTING))
-
- self.assertEqual("POST_ON_ERROR",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_ERROR))
-
- self.assertEqual("POST_ON_RESET",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_RESET))
-
- self.assertEqual("POST_ON_EXECUTE",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_EXECUTE))
-
- self.assertEqual("POST_ON_STATE_UPDATE",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_STATE_UPDATE))
-
- self.assertEqual("POST_ON_RATE_CHANGED",
- PostComponentActionListener.toString(
- PostComponentActionListenerType.POST_ON_RATE_CHANGED))
-
- return
-
- def test_PortActionListener_toString(self):
- self.assertEqual("ADD_PORT",
- PortActionListener.toString(
- PortActionListenerType.ADD_PORT))
-
- self.assertEqual("REMOVE_PORT",
- PortActionListener.toString(
- PortActionListenerType.REMOVE_PORT))
-
- return
-
- def test_ExecutionContextActionListener_toString(self):
- self.assertEqual("ATTACH_EC",
- ExecutionContextActionListener.toString(
- ExecutionContextActionListenerType.EC_ATTACHED))
-
- self.assertEqual("DETACH_EC",
- ExecutionContextActionListener.toString(
- ExecutionContextActionListenerType.EC_DETACHED))
-
- return
-
-
- def test_PreComponentActionListenerHolder(self):
- preactions = ComponentActionListeners()
- listener = MockPreComponentActionListener()
- preactions.preaction_[0].addListener(listener,True)
- preactions.preaction_[0].notify("test precomp ec_id")
- preactions.preaction_[0].removeListener(listener)
- return
-
- def test_PostComponentActionListenerHolder(self):
- postactions = ComponentActionListeners()
- listener = MockPostComponentActionListener()
- postactions.postaction_[0].addListener(listener,True)
- postactions.postaction_[0].notify("test postcomp ec_id",True)
- postactions.postaction_[0].removeListener(listener)
- return
-
- def test_PortActionListenerHolder(self):
- portactions = ComponentActionListeners()
- listener = MockPortActionListener()
- portactions.portaction_[0].addListener(listener,True)
- portactions.portaction_[0].notify("test port pprof")
- portactions.portaction_[0].removeListener(listener)
- return
-
- def test_ExecutionContextActionListenerHolder(self):
- ecactions = ComponentActionListeners()
- listener = MockExecutionContextActionListener()
- ecactions.ecaction_[0].addListener(listener,True)
- ecactions.ecaction_[0].notify("test ec ec_id")
- ecactions.ecaction_[0].removeListener(listener)
- return
-
-
-############### test #################
-if __name__ == '__main__':
- unittest.main()
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConfigurationListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConfigurationListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConfigurationListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file test ConfigurationListener.py
-# @brief test for ConfigurationListener class
-# @date $Date$
-# @author Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-import sys
-sys.path.insert(1,"../")
-
-import unittest
-
-from ConfigurationListener import *
-import OpenRTM_aist
-
-config_set = ["conf.default.int_param0", "0",
- "conf.default.int_param1", "1",
- "conf.default.double_param0", "0.11",
- "conf.default.double_param1", "9.9",
- "conf.default.str_param0", "hoge",
- "conf.default.str_param1", "dara",
- "conf.default.vector_param0", "0.0,1.0,2.0,3.0,4.0",
- ""]
-
-class MockConfigurationParamListener(ConfigurationParamListener):
- def __init__(self):
- ConfigurationParamListener.__init__(self)
- return
-
- def __call__(self, config_set_name, config_param_name):
- return (config_set_name, config_param_name)
-
-class MockConfigurationSetListener(ConfigurationSetListener):
- def __init__(self):
- ConfigurationSetListener.__init__(self)
- return
-
- def __call__(self, config_set):
- return config_set
-
-class MockConfigurationSetNameListener(ConfigurationSetNameListener):
- def __init__(self):
- ConfigurationSetNameListener.__init__(self)
- return
-
- def __call__(self, config_set_name):
- return config_set_name
-
-
-class TestListener(unittest.TestCase):
- def setUp(self):
- return
-
- def tearDown(self):
- OpenRTM_aist.Manager.instance().shutdownManager()
- return
-
- def test_ConfigurationParamListener_toString(self):
- self.assertEqual("ON_UPDATE_CONFIG_PARAM",
- ConfigurationParamListener.toString(
- ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM))
- return
-
- def test_ConfigurationSetListener_toString(self):
- self.assertEqual("ON_SET_CONFIG_SET",
- ConfigurationSetListener.toString(
- ConfigurationSetListenerType.ON_SET_CONFIG_SET))
- self.assertEqual("ON_ADD_CONFIG_SET",
- ConfigurationSetListener.toString(
- ConfigurationSetListenerType.ON_ADD_CONFIG_SET))
- return
-
- def test_ConfigurationSetNameListener_toString(self):
- self.assertEqual("ON_UPDATE_CONFIG_SET",
- ConfigurationSetNameListener.toString(
- ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET))
- self.assertEqual("ON_REMOVE_CONFIG_SET",
- ConfigurationSetNameListener.toString(
- ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET))
- self.assertEqual("ON_ACTIVATE_CONFIG_SET",
- ConfigurationSetNameListener.toString(
- ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET))
- return
-
- def test_ConfigurationParamListenerHolder(self):
- configparams = ConfigurationListeners()
- listener = MockConfigurationParamListener()
- configparams.configparam_[0].addListener(listener,True)
- configparams.configparam_[0].notify("config_set_name","config_param_name")
- configparams.configparam_[0].removeListener(listener)
- return
-
- def test_ConfigurationSetListenerHolder(self):
- configsetss = ConfigurationListeners()
- listener = MockConfigurationSetListener()
- configsets.configset_[0].addListener(listener,True)
- prop = OpenRTM_aist.Properties(defaults_str=config_set)
- configsets.configset_[0].notify(prop)
- configsets.configset_[0].removeListener(listener)
- return
-
- def test_ConfigurationSetNameListenerHolder(self):
- configsetnames = ConfigurationListeners()
- listener = MockConfigurationSetNameListener()
- configsetnames.configsetname_[0].addListener(listener,True)
- configsetnames.configsetname_[0].notify("config_set_name")
- configsetnames.configsetname_[0].removeListener(listener)
- return
-
-
-############### test #################
-if __name__ == '__main__':
- unittest.main()
-
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConnectorListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConnectorListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_ConnectorListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,12 +1,12 @@
#!/usr/bin/env python
# -*- Python -*-
-##
-# @file test_ConnectorListener.py
-# @brief test for connector listener class
-# @date $Date: 2010/01/06 $
-# @author Shinji Kurihara
#
+# \file test_ConnectorListener.py
+# \brief test for connector listener class
+# \date $Date: 2010/01/06 $
+# \author Shinji Kurihara
+#
# Copyright (C) 2010
# Task-intelligence Research Group,
# Intelligent Systems Research Institute,
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_PortConnectListener.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_PortConnectListener.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_PortConnectListener.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,119 +0,0 @@
-#!/usr/bin/env python
-# -*- Python -*-
-
-##
-# @file test_PortConnectListener.py
-# @brief test for port connector listener class
-# @date $Date: 2011/03/18 $
-# @author Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-
-import sys
-sys.path.insert(1,"../")
-
-import unittest
-import OpenRTM_aist
-from PortConnectListener import *
-
-import RTC, RTC__POA
-import OpenRTM
-
-from omniORB import *
-from omniORB import any
-
-class MockPortConnectListener(PortConnectListener):
- def __init__(self):
- PortConnectListener.__init__(self)
- return
-
- def __call__(self,portname,profile):
- return
-
-
-class MockPortConnectRetListener(PortConnectRetListener):
- def __init__(self):
- PortConnectRetListener.__init__(self)
- return
-
- def __call__(self,portname,profile,ret):
- return
-
-
-
-class TestListener(unittest.TestCase):
- def setUp(self):
- return
-
- def tearDown(self):
- OpenRTM_aist.Manager.instance().shutdownManager()
- return
-
- def test_PortConnectListener_toString(self):
- self.assertEqual("ON_NOTIFY_CONNECT",
- PortConnectListener.toString(
- PortConnectListenerType.ON_NOTIFY_CONNECT))
-
- self.assertEqual("ON_NOTIFY_DISCONNECT",
- PortConnectListener.toString(
- PortConnectListenerType.ON_NOTIFY_DISCONNECT))
-
- self.assertEqual("ON_UNSUBSCRIBE_INTERFACES",
- PortConnectListener.toString(
- PortConnectListenerType.ON_UNSUBSCRIBE_INTERFACES))
- return
-
-
- def test_PortConnectRetListener_toString(self):
- self.assertEqual("ON_PUBLISH_INTERFACES",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_PUBLISH_INTERFACES))
-
- self.assertEqual("ON_CONNECT_NEXTPORT",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_CONNECT_NEXTPORT))
-
- self.assertEqual("ON_SUBSCRIBE_INTERFACES",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_SUBSCRIBE_INTERFACES))
-
- self.assertEqual("ON_CONNECTED",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_CONNECTED))
-
- self.assertEqual("ON_DISCONNECT_NEXT",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_DISCONNECT_NEXT))
-
- self.assertEqual("ON_DISCONNECTED",
- PortConnectRetListener.toString(
- PortConnectRetListenerType.ON_DISCONNECTED))
- return
-
-
- def test_PortConnectListenerHolder(self):
- portconlisteners = PortConnectListeners()
- listener = MockPortConnectListener()
- portconlisteners.portconnect_[0].addListener(listener,True)
- portconlisteners.portconnect_[0].notify("port_name",None)
- portconlisteners.portconnect_[0].removeListener(listener)
- return
-
- def test_PortConnectRetListenerHolder(self):
- portconretlisteners = PortConnectRetListeners()
- listener = MockPortConnectRetListener()
- portconretlisteners.portconnret_[0].addListener(listener,True)
- portconretlisteners.portconnret_[0].notify("port_name",None)
- portconretlisteners.portconnret_[0].removeListener(listener)
- return
-
-
-############### test #################
-if __name__ == '__main__':
- unittest.main()
-
Deleted: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_SdoServiceAdmin.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_SdoServiceAdmin.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/test/test_SdoServiceAdmin.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -1,139 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: euc-jp -*-
-
-##
-# @file test_SdoServiceAdmin.py
-# @brief test for SdoServiceAdmin class
-# @date $Date$
-# @author Shinji Kurihara
-#
-# Copyright (C) 2011
-# Intelligent Systems Research Institute,
-# National Institute of
-# Advanced Industrial Science and Technology (AIST), Japan
-# All rights reserved.
-
-import sys
-sys.path.insert(1, "../")
-
-import unittest
-from SdoServiceAdmin import *
-import OpenRTM_aist
-import SDOPackage,SDOPackage__POA
-from omniORB import CORBA, PortableServer
-from omniORB import any
-
-
-class MockRTC(OpenRTM_aist.RTObject_impl):
- def __init__(self):
- self._orb = CORBA.ORB_init()
- self._poa = self._orb.resolve_initial_references("RootPOA")
- OpenRTM_aist.RTObject_impl.__init__(self, orb=self._orb, poa=self._poa)
- pass
-
-
-class SDOServiceMock(SDOPackage__POA.SDOService):
- def __init__(self):
- pass
-
-class MockSdoServiceConsumer(OpenRTM_aist.SdoServiceConsumerBase):
- """
- """
-
- def __init__(self):
- OpenRTM_aist.SdoServiceConsumerBase.__init__(self)
- return
-
- def reinit(self, profile):
- pass
-
- def getProfile(self):
- any_val = any.to_any("3.14159")
- nv = SDOPackage.NameValue("PROPERTIES NAME 0", any_val)
- sprof = SDOPackage.ServiceProfile("test id","INTERFACE_TYPE",[nv],SDOServiceMock())
- return sprof
-
-
-class TestListener(unittest.TestCase):
- def setUp(self):
- return
-
-
- def tearDown(self):
- OpenRTM_aist.Manager.instance().shutdownManager()
- return
-
-
- def test_addSdoServiceConsumerFactory(self):
- sdoadmin = SdoServiceAdmin(MockRTC())
- self.assertEqual(sdoadmin.addSdoServiceConsumerFactory(),False)
- return
-
-
- def test_removeSdoServiceConsumerFactory(self):
- sdoadmin = SdoServiceAdmin(MockRTC())
- self.assertEqual(sdoadmin.removeSdoServiceConsumerFactory(),False)
- return
-
-
- def test_addSdoServiceConsumer(self):
- any_val = any.to_any("3.14159")
- nv = SDOPackage.NameValue("PROPERTIES NAME 0", any_val)
- sprof = SDOPackage.ServiceProfile("ID 0","INTERFACE_TYPE",[nv],SDOServiceMock())
- sdoadmin = SdoServiceAdmin(MockRTC())
- self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),False)
- return
-
-
- def test_removeSdoServiceConsumer(self):
- any_val = any.to_any("3.14159")
- nv = SDOPackage.NameValue("PROPERTIES NAME 0", any_val)
- sprof = SDOPackage.ServiceProfile("test id","INTERFACE_TYPE",[nv],SDOServiceMock())
- sdoadmin = SdoServiceAdmin(MockRTC())
- self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),False)
- sdoadmin._consumers.append(MockSdoServiceConsumer())
- self.assertEqual(sdoadmin.removeSdoServiceConsumer("test id"),True)
- self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),False)
- sdoadmin._consumers.append(MockSdoServiceConsumer())
- self.assertEqual(sdoadmin.removeSdoServiceConsumer("test id2"),False)
- return
-
-
- def test_isAllowedConsumerType(self):
- sdoadmin = SdoServiceAdmin(MockRTC())
- any_val = any.to_any("3.14159")
- nv = SDOPackage.NameValue("PROPERTIES NAME 0", any_val)
- sprof = SDOPackage.ServiceProfile("test id","INTERFACE_TYPE",[nv],SDOServiceMock())
- self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),True)
- sdoadmin._allConsumerAllowed = False
- self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),False)
- sdoadmin._consumerTypes = ["type0","type1","type2","INTERFACE_TYPE"]
- self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),True)
- sdoadmin._consumerTypes = ["type0","type1","type2"]
- self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),False)
- return
-
-
- def test_isExistingConsumerType(self):
- factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
- factory.addFactory("test_factory",OpenRTM_aist.SdoServiceConsumerBase,OpenRTM_aist.Delete)
- sdoadmin = SdoServiceAdmin(MockRTC())
- any_val = any.to_any("3.14159")
- nv = SDOPackage.NameValue("PROPERTIES NAME 0", any_val)
- sprof = SDOPackage.ServiceProfile("test id","INTERFACE_TYPE",[nv],SDOServiceMock())
- self.assertEqual(sdoadmin.isExistingConsumerType(sprof),False)
- factory.addFactory("INTERFACE_TYPE",OpenRTM_aist.SdoServiceConsumerBase,OpenRTM_aist.Delete)
- self.assertEqual(sdoadmin.isExistingConsumerType(sprof),True)
- return
-
-
- def test_getUUID(self):
- sdoadmin = SdoServiceAdmin(MockRTC())
- self.assertNotEqual(sdoadmin.getUUID(),"")
- self.assertNotEqual(sdoadmin.getUUID(),None)
- return
-
-
-############### test #################
-if __name__ == '__main__':
- unittest.main()
Property changes on: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/utils/rtc-template
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/RELENG_1_0/OpenRTM-aist-Python/OpenRTM_aist/utils/rtm-naming
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: branches/RELENG_1_0/OpenRTM-aist-Python/setup.py
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist-Python/setup.py 2011-06-16 05:44:51 UTC (rev 411)
+++ branches/RELENG_1_0/OpenRTM-aist-Python/setup.py 2011-06-16 06:01:09 UTC (rev 412)
@@ -418,15 +418,6 @@
win32_packages = ["OpenRTM_aist",
"OpenRTM_aist.RTM_IDL",
- "OpenRTM_aist.RTM_IDL.OpenRTM",
- "OpenRTM_aist.RTM_IDL.OpenRTM__POA",
- "OpenRTM_aist.RTM_IDL.RTC",
- "OpenRTM_aist.RTM_IDL.RTC__POA",
- "OpenRTM_aist.RTM_IDL.RTM",
- "OpenRTM_aist.RTM_IDL.RTM__POA",
- "OpenRTM_aist.RTM_IDL.SDOPackage",
- "OpenRTM_aist.RTM_IDL.SDOPackage__POA",
- "OpenRTM_aist.RTM_IDL.device_interfaces",
"OpenRTM_aist.examples.AutoControl",
"OpenRTM_aist.examples.Composite",
"OpenRTM_aist.examples.ConfigSample",
@@ -614,8 +605,8 @@
scripts= ['OpenRTM_aist/utils/rtcprof/rtcprof_python.bat',
'OpenRTM_aist/utils/rtcd/rtcd_python.bat',
'OpenRTM_aist/utils/rtcd/rtcd_python.exe'],
- data_files = win32_data_files)
-# script_args = ["sdist", "--format=zip"])
+ data_files = win32_data_files,
+ script_args = ["sdist", "--format=zip"])
except Exception, e:
log.error("Error: %s", e)
openrtm-commit メーリングリストの案内